vigenere (C)

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

I did the problem before I watched the whole video and the way I wrapped around is with a simple if statement at the beginning of the loop
if (keyi >= avlen)
{
keyi = 0;
}

Where keyi is the key indexer, an int starting at 0, increment each time I use a character in my key, and avlen is the argument vector length, that is, the length of my key string passed into through main/command-line argument.

So the only case that matches is that keyi is equal to the length of the key, meaning I should not use it and instead reset it to 0.
The "greater than" is added as a safety net, but the key indexer should never be greater than the length of the key.

A more straightforward approach for my mind.

SilverMiraii
Автор

Im having so much trouble with this one :(

d_m_
welcome to shbcf.ru