I read about ROT13 cyper and tried to make one myself.
Code:
void rot13(char *start){
int i;
for (i=0; i<strlen(start); i++)
{
if( (*start>='a' && *start<'n') || (*start>='A' && *start<'N') )
*start += 13;
else
*start -= 13;
}
}
It didn't work for me and then found a code online,
Code:
void rot13(char *text){
for(;*text;text++)
{
if(*text>'A'&&*text<'N'||*text>'a'&&*text<'n')*text+=13;
else if(*text>'M'&&*text<'Z'||*text>'m'&&*text<'z')*text-=13;
}
}
(I might've edited my code after reading the online code )
But why is mine not working?
And, in second code, A,z,Z,z doesn't satisfy any condition, or am I not understanding the code correctly?