Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write m e all the T O D O TASKS: #include #include #include #include #include using namespace std; const string ALPHABET = ABCDEFGHIJKLMNOPQRSTUVWXYZ; /

Please write me all the TODO TASKS: #include
#include
#include
#include
#include
using namespace std;
const string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Function prototypes at the top of the file for function decomposition
/**
* Print instructions for using the program.
*/
void printMenu();
/**
* Returns the 0-based index in the English alphabet where `c` appears,
* or -1 if `c` is not an uppercase letter in the alphabet.
*
* For example:
*-`findIndexInAlphabet('A')` returns 0
*-`findIndexInAlphabet('D')` returns 3
*-`findIndexInAlphabet('+')` returns -1
*-`findIndexInAlphabet('a')` returns -1
*/
int findIndexInAlphabet(char c);
/**
* Returns `c` rotated by `amount` many characters forward. If we run out
* of letters in the alphabet, wrap around back to 'A'. This method
* assumes that `c` is an uppercase letter.
* For example:
*-`rot('A',0)` returns 'A'
*-`rot('A',1)` returns 'B'
*-`rot('Z',1)` returns 'A'
*-`rot('A',10)` returns 'K'
*-`rot('J',25)` returns 'I'
*/
char rot(char c, int amount);
/**
* Returns a new string in which every character has been rotated by `amount`
* letters. Lowercase letters are converted to uppercase and rotated.
* Non-alphabetic characters are left alone.
* For example:
*`rot("A",0)` returns "A"
*`rot("AA",3)` returns "DD"
*`rot("HELLO",0)` returns "HELLO"
*`rot("HELLO",1)` returns "IFMMP"
*`rot("oh HEL-LO!",1)` returns "PI IFM-MP!"
*/
string rot(string line, int amount);
int main(){
string command;
cout << "Welcome to Ciphers!" << endl;
cout <<"-------------------"<< endl;
cout << endl;
do {
printMenu();
cout << endl
<< "Enter a command (case does not matter): ";
// Use getline for all user input to avoid needing to handle
// input buffer issues relating to using both >> and getline
getline(cin, command);
cout << endl;
// TODO_STUDENT: Execute non-exit commands
cout << endl;
} while (!(command =="x"|| command =="X"));
return 0;
}
void printMenu(){
cout << "Ciphers Menu" << endl;
cout <<"------------"<< endl;
// Caesar Ciphers
cout <<"C - Encrypt with Caesar Cipher" << endl;
cout <<"D - Decrypt Caesar Cipher" << endl;
// Vigenere
cout <<"V - Encrypt with Vigenre"<< endl;
// Utility
cout <<"X - Exit Program" << endl;
}
int findIndexInAlphabet(char c){
// TODO_STUDENT
return -1;
}
char rot(char c, int amount){
// TODO_STUDENT
return c;
}
string rot(string line, int amount){
// TODO_STUDENT
return line;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions