0

Don't understand why it's not working

enter image description here

enter image description here

enter image description here

1

I see several issues. First, when encoding, 97 (or 65) is subtracted from the ASCII value of the plaintext letter, but not from the ASCII value of the key letter, so the math is wrong.

Second, what happens when the case of the plain text and the key are different - one is uppercase and the other is lowercase?

Third, the index variable for the key, j, is incremented for every character that is processed. It should only be incremented for alphas that are encoded. That means that as soon as you process a non-alpha like a space, number or punctuation, the key will be out of synch from the string being encoded.

There may be other issues, but this will get you going.

If this answers your question, please click on the check mark to accept the answer. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

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