I've reached the final step of Vigenere, but I don't really understand how do I loop the key over plaintext
. This is the shift
function I've created:
int shift(char c)
{
if(isalpha(c))
{
if(isupper(c))
{
int b = c - 65;
return b;
}
if(islower(c))
{
int b = c - 97;
return b;
}
}
{
printf("\n");
return 0;
}
}
While trying to understand how I do that, I've looked up examples and it seems that you need for
loop with 2
(1 for keyword and other for plaintext) counters
, but hints of this problem states that "it's easier to control the keyword counter yourself, rather than relying on the for loop ", so this makes me a bit confused.
Let's say I use for
loop with 2
counters: how does these counters
affect my plaintext
, considering that I'm only changing the shift function
? And how does for
loop with 2
counters work exactly?
I hope this mess makes sense.