I somehow managed to come up with this code to vigenere but it gives me 9/11 with check50. It encrypts it badly when using the keyword BaZ and BAZ. Why is that please? And also I think I was supposed to use a function (according to the tutorial) that would shift the value but I came up only with this. How would the code look like with the function? Thank you

[removed solution code]

1 Answer 1


Your issue is a misplaced ) when you calculate the key.

int letterKey = tolower(k[j % kLen] - 'a');

You want to lowercase the key and then subtract 'a'. Move your closing brace.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .