Hey all, I've been making a caesar cipher but seem to have encountered a problem. My program reads an integer from a text file and stores it as the shift value. Then my goal was to add that shift value to the alphabet array. Here is a part of my code:
inFile.get (shift);
cout << "Original Alphabet: ";
for(int i = 0; i < length; i++)
cout << alphabet[i];
cout << endl;
cout << "Shift Value: " << shift << endl;
cout << "Encrypted Alphabet: ";
for(int i = 0; i < length; i++)
{
Caesar[i] = alphabet[(i + shift) % length];
cout << Caesar[i];
My issue is that the shift value comes out as 4, however the caesar array comes out identical to the alphabet array.