I'm almost done with a program to decrypt text from both caesar and substitution type ciphers. My program is supposed to read the first integer in a text file and use that as a shift. I have the substitution function working without a hitch. For some reason the output in my caesar function is coming out really strange, not sure what part of the function is in error. Whole program compiles fine. Below is the code for my function
int ciphervalue; // hold cipher subtraction value
inFile >> ciphervalue; // grab cipher subtraction value from file
char Alphabet_letters; // hold character value
while (inFile.get(Alphabet_letters)){ // while reading characters
Why not simply iterate over the string doing this:
1) check if it is a letter
2) if 1 is false goto step 4
else make the letter uppercase and add the shift
3) if the shift is positive(right) and greater than 'Z' subtract 26
if the shift is negative(left) and less than 'a' add 26.
4)move to next character