Having an issue with my formula. I don't think it is wrapping around the key word like its supposed to. through the first pass of the keyword it seems the encoding is correct but after that it is not enciphering correctly. Any help would be greatly appreciated!
int j = 0;
for (int i = 0, n = strlen(text); i < n; i++)
{
if (isupper(text[i]))
{
int KeyIndex = argv[1][j] - 65;
int UserIndex = text[i] - 65;
int cipher = (UserIndex + KeyIndex) % 26;
int ToAscii = cipher + 65;
printf("%c", ToAscii);
}
j++;
}