My vigenere program, compiles and has most of the check50 test-thingy right. However, I cannot get the program to print out the cipher. Not sure what is legal here or not but I have gone over and made sure that I haven't placed brackets or the ; in the wrong places. It is similar to the caesar loop-- and that printed out. What am I doing wrong? All the other aspects of the program check out ok. I've also checked to make sure all the open closed brackets match.
for(int i = 0, n = strlen(p); i < n; i++ )//ptext loop
{
for(int j = 0, m = strlen(k); j % m; j++) //cipher loop
{
if (p[i] >= 65 && p[i] <= 90)
{
c = (p[i] + (k[j] -65)) % 26;
printf("%c", c);
}
else if (p[i] >= 97 && p[i] <= 122)
{
a = (p[i] + (k[j]- 97)) % 26;
printf("%c", a);
}
else
{
printf("%c", p[i]);
j--;
}
}