The logical error is occurring when i try to shift each character of the plaintext by 1
string plaintext= get_string("plaintext: ");
//aplplying key
for(int j=0,m=strlen(plaintext);j<m;j++)
{
if(isalpha(plaintext[j]))
{
char c= plaintext[j];
printf("ciphertext: %c",c+1);
}
else
printf("%c",plaintext[j]);
}
printf("\n");
The flawed output:
./caesar 2
2
plaintext: hi
ciphertext: iciphertext: j