/* Read in a string Convert all alphabetic characters by shifting by 3 D->A A->X N->K */ #include #include using namespace std; int main() { // 11111 //012345678901234 string plainText{"DAN WAS HERE 2!"}; string codeText; int i; i = 0; while (i < plainText.size()){ if ('A' == plainText[i]) { codeText = codeText + "X" ; } else if ('B' == plainText[i]) { codeText = codeText + "Y" ; } else if ('C' == plainText[i]) { codeText = codeText + "Z" ; } else if(isalpha(plainText[i])) { codeText = codeText + char( int(plainText[i]) - 3) ; } else { codeText = codeText + plainText[i]; } i++; } cout << "The Plain Text is " << plainText << endl; cout << "The Cypher Text is " << codeText << endl; return 0; }