Need Help with Caeser Cipher

Im trying to write a code for a ceaser cipher, and it needs tp be done with arrays or related objects (vectors). Im currently having problems with the encryption process;
I created an array for the alphabet, and each corresponding element is matched to its appropriate lettr in the array with a for loop. After this, the element is reassigned based on a given shift amount. Problem is, it keeps writing the same letter for all elements of the original message, and they dont even correspond to the correct amount of shifts for any of them. Help/advice?
Below is the code Ive written/attempted to write.

if (input == 2){
cout << "Please choose the number of shifts you want: ";
int shift; cin >> shift;

for (int j=0; j<inputcount; j++){
int k =j-shift;
if (k<0){k=26+k; text[j]=codex[k];}
else {text[j]=codex[k];}
}
cout << "The encrypted message is: ";
for (int k=0; k<inputcount;k++){
cout<< text[k];
}

goto MENU;}
Well, it would be easier if we could check the other part too...
Topic archived. No new replies allowed.