I tried the ciphertext += plain[i] that you suggested. It just adds the plaintext to the ciphertext.
Isn't that what you want? To add the plaintext unencrypted to the ciphertext when it is not an alphabetical character?
My problem lies in the key I believe. It skips a letter when it encounters a space or special character, which in turn messes up decryption.
Wait, so you don't want to advance the key position when skipping a plaintext letter, then? That makes things more difficult, as you have only one number indicating where you are in both arrays... You could add an extra variable inside the loop that only increments when you actually use the key value.
I`m just a newbie but have you thought if it is posible to assign a space character to the space character ?
something like this ?
1 2 3 4 5
A T T A C K A T D A W N
L E M O N L E M O N L E
A T T A C K A T D A W N
L E M O N L E M O N L E
Maybe the code should count the characters till it finds a space char and put it to the "lemon" cypher ?
Some kind of splitting the key word into multiple words and repeat the coding but going on from the letter of the cypher the last word stoped ?