I think I have a basic understanding of what I need to do to solve vigenere. However, I have trouble applying the key loop to the message loop. Specifically, I have a couple of questions.
I created a loop for the key as follows:
for (int x = 0; x < keylen, x ++) { keyarray[x] = ((toupper(key[x])) - 'A'); }
And then another loop for the message:
for (int j = 0; j < MsgLen; i ++)
//code to code message when alphabetical. else code message when
I know I can't make the key loop inside the message loop since it will run key loop * message loop times. I also know the "x" in the key loop is only supposed to increase by 1 whenever I'm encoding a message an alphabet in the code loop. I need help udnerstanding how to increment that way and applying the key array to the code loop. I tried initializing x and keyarray outside the loop but I still have the issue up having to update x inside the key loop rather than in the code loop.
I was thinking about making a prototype for the key loop and run that inside of the message loop only when it is encoding a message....but again, I don't see that differs from just putting the key loop inside the code loop and expecting that the code to run too many times (key loop * message loop) again.
Any help with be appreciated. Thank you so much!