C ++ In this assignment, you are to write a ROT13 (for \"rotate 13\") decoder to
ID: 3650773 • Letter: C
Question
C ++ In this assignment, you are to write a ROT13 (for "rotate 13") decoder to translate a secret message from its encoded state to something readable. In a ROT13 code, 'a' is shifted 13 letters to 'n', 'B' to 'O', 'c' to 'p', 'D' to 'Q', ..., 'N' to 'A', 'o' to 'b', 'P' to 'C', 'q' to 'd', etc. Only letters are affected; punctuation, spaces, and all other characters remain the same. Your program should read the secret message out of a file called "secretMessage.txt" and should write the decoded message into a file called "decodedMessage.txt" Please take care to name the files exactly as shown in this description, paying particular care to capitalization.Explanation / Answer
#include #include using namespace std; int main() { ifstream myReadFile; myReadFile.open("secretMessage.txt"); ofstream myfile; myfile.open ("decodedMessage.txt"); char c;int n; if (myReadFile.is_open()) { while ((c = getchar())!=EOF) { n=c; if(n>=97 && n122) n=n-122+96; } if(n>=65 && n90) n=n-90+64; } c=n; myfileRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.