Question
Using C++ Vector class . #include using namespace std; #include #include /*function prototypes*/ void showMenu(); void add(vectorchar> &ch); void remove(vectorchar> &ch); void show(vectorchar> &ch); int
Using C++ Vector class
.
#include
using namespace std;
#include
#include
/*function prototypes*/
void showMenu();
void add(vectorchar> &ch);
void remove(vectorchar> &ch);
void show(vectorchar> &ch);
int main(){
vectorchar> char_vec;
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(vectorchar> &ch) {
/*prompt the user to enter a character
and add the character to the vector.*/
}
void remove(vectorchar> &ch) {
/*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(vectorchar> &ch) {
/*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(vectorStep 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