Question
code: Pageof 2 ZOOM #include using namespace std; #include #include /*function prototypes*/ void showMenu(); void add(vector &ch); void remove(vector &ch); void show(vector &ch); int main(){
code:
Pageof 2
ZOOM
#include
using namespace std;
#include
#include
/*function prototypes*/
void showMenu();
void add(vector
void remove(vector
void show(vector
int main(){
vector
int input;
while (true) {
showMenu();
cin >> input;
switch (input){
case 1: add(char_vec);
break;
case 2: remove(char_vec);
break;
case 3: show(char_vec);
break;
case 4: return 0;
break;
default: cout
}
cout
}
return 0;
}
void showMenu() {
cout
cout
cout
cout
cout
}
/*complete the following functions: */
void add(vector
/*prompt the user to enter a character
and add the character to the vector.*/
}
void remove(vector
/*prompt the user to enter a character
to remove. then remove that character
from the vector.*/
/*HINT: you need to use the iterator
vector
your vector using a for loop. if the item
in your vector at that index is equal to the
key, then erase the item and print a message
stating that the item has been removed.*/
}
void show(vector
/*print the contents of the vector.
remember to check if the vector is
empty first.*/
/*HINT: you need to use the iterator
vector
through your vector and print its
contents*/
}
Design the following menu-driven application using C++ Vector class. Implement the following five functions 1. Add(vectorcchar> &ch) Prompts th ser to provide a character and add that character int the vect r 2. Remove(vectorcchar> &ch) Prompts the user to provide a character. If the character is found in the vector, it removes that character. Otherwise, it generates a message 3. Show(vectorcint &num) sh w the existing members f the vector ( rder d matter) It wi11 generate a message if it is empty n t Sample output: Add a character Renove a character Show the characters Quit dd a character Remove a character Show the characters Quit Lease enter a choice: 2 Lease enter the character: he character was not found Add a character Remove a character Sho the characters Quit Lease enter a choice: 1 Lease enter the character: a Please enter a choice:3 Add a character Renove a character Show the characters Quit Add a character Remove a character Show the characters Quit Lease enter a choice: 1 Lease enter the character: b Lease enter a choice: 2 Lease enter the character: a he character has been removedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started