Whenever I input string such as Dizzy with key 10 for example the output is partially wrong. I am having something like this ===>ns���
while I should have nsjji
.
Serial.print("KEY: ");
Serial.println(k);
if ((choice[0]=='e') || (choice[0]=='E')){
int i;
char ch;
for (i=0; str[i] != '\0'; i++){
ch=str[i];
if( ch >= 'a' && ch <= 'z'){
ch=ch+k;
if (ch >'z'){
ch=ch-'z'+'a'-1;
}
str[i]=ch;
}
else if(ch >='A' && ch <= 'Z'){
ch=ch+k;
if (ch > 'Z'){
ch=ch-'Z'+'A'-1;
}
str[i]=ch;
}
}
Serial.print("encrypt: ");
Serial.println(str);