Hi all
I am having some bother with a while loop that is driving me nuts. The code works but doesn't seem to encrpt the inputted text. It works on that it will encrpt until a higher letter is entered that small a to z.
c = (unsigned char)getchar(); /* read in first character */
/*
* main encryption/decryption loop
* loop while characters are lower case letters or spaces
*/
while (c>='a' && c<='z' || c==' ')
{
if (c==' ')
{
switch (type)
{
case 'd':
c = decrypt;
default:
c = encrypt;
}
}
putchar(c); /* display encrypted/decrypted character */
c = (unsigned char)getchar(); /* get next character */
}
/*
* end of main while loop
*/
I am having some bother with a while loop that is driving me nuts. The code works but doesn't seem to encrpt the inputted text. It works on that it will encrpt until a higher letter is entered that small a to z.
c = (unsigned char)getchar(); /* read in first character */
/*
* main encryption/decryption loop
* loop while characters are lower case letters or spaces
*/
while (c>='a' && c<='z' || c==' ')
{
if (c==' ')
{
switch (type)
{
case 'd':
c = decrypt;
default:
c = encrypt;
}
}
putchar(c); /* display encrypted/decrypted character */
c = (unsigned char)getchar(); /* get next character */
}
/*
* end of main while loop
*/