I'm a begginer so I'm stuck in this part. I need to type a message, and a shift amount by which letters should be shifted to 'encrypt' a message. The problem is that It's not displaying any text, it just never exits the while loop.
Any help would be greatly appreciated.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch,message[50]={0};
int shift;
printf("Enter message to be encrypted: ");
scanf("%s",message);
printf("Enter shift amount (1-25): ");
scanf("%d",&shift);
printf("Encrypted message: ");
while((sscanf(message," %c",&ch) == 1) && (ch != '\n'));
{
ch += shift;
putchar(ch);
}
return 0;
}
Output:
Enter message to be encrypted: abcABC
Enter shift amount (1-25): 3
Encrypted message:
(Program is stucked there in an infite loop)