Question: Can you change the code below to (do-loop) format please #include using namespace std; int main() { // Get command choice cout < < Welcome

Can you change the code below to (do-loop) format please #include  using namespace std; int main() { // Get command choice cout << "Welcome to Caesar's Cipher 2.0 " << " 1) Encode using classic algorithm " << " 2) Decode using classic algorithm " << " 3) Encode using improved algorithm " << " 4) Decode using improved algorithm " << "Enter command [1..4]: "; int command; cin >> command; // Get shift value int shift = 0; cout << "Enter shift value: "; cin >> shift; // Read user input cout << "Enter message to encode/decode: "; char input = ' '; char output = ' '; // Encode using classic algorithm if (command == 1) { cin.get(input); while (input != '.') { // Check input letter is between [A..Z] if ((input >= 'A') && (input <= 'Z')) { // Shift left for encode output = input - shift; if (output < 'A') output += 26; } // Print any spaces that occur else if (input == ' ') output = ' '; // Print results cout << output; cin.get(input); } } // Decode using classic algorithm else if (command == 2) { cin.get(input); while (input != '.') { // Check input letter is between [A..Z] if ((input >= 'A') && (input <= 'Z')) { // Shift right for decode output = input + shift; if (output > 'Z') output -= 26; } // Print any spaces that occur else if (input == ' ') output = ' '; // Print results cout << output; cin.get(input); } } // Encode using improved algorithm else if (command == 3) { cin.get(input); while (input != '.') { // Check input letter is between [A..Z] if ((input >= 'A') && (input <= 'Z')) { // Shift left for encode output = input - shift; if (output < 'A') output += 26; } // Print any spaces that occur else if (input == ' ') output = ' '; // Update shift value with improved algorithm shift = (shift % 25) + 1; // Print results cout << output; cin.get(input); } } // Decode using improved algorithm else if (command == 4) { cin.get(input); while (input != '.') { // Check input letter is between [A..Z] if ((input >= 'A') && (input <= 'Z')) { // Shift right for decode output = input + shift; if (output > 'Z') output -= 26; } // Print any spaces that occur else if (input == ' ') output = ' '; // Update shift value with improved algorithm shift = (shift % 25) + 1; // Print results cout << output; cin.get(input); } } cout << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!