I have run the debugger tested different combinations in my code, but I can't figure out why nothing is functioning. I input abc, I output abc.
My program seems to determine all characters from the string as non alphabetical, so it just passes down to "printf("%c", p[i]);".
I'm stumped, thank you for your help.
for (int i = 0, n = strlen(p); i < n; i++)
{
if (isalpha(p[i]) == true)
{
if (isupper(p[i]) == true)
{
//compute algorithm for upper case letters
p[i] = (((p[i] - 65) + k) % 26) + 65;
printf("%c", p[i]);
}
else
{
//compute algorithm for lower case letters
p[i] = (((p[i] - 97) + k) % 26) + 97;
printf("%c", p[i]);
}
}
else
{
//print any non alphabetic characters
printf("%c", p[i]);
}
}