Starting from:
$30

$24

Lab 21 Solution

Objectives:




Using C++ Vector class.







Question:




Design the following menu-driven application using C++ Vector class. Implement the following five functions:




Add(vector<int &num)



Prompts the user to provide a number and add that number into the vector




Remove(vector<int &num)



Prompts the user to provide a number. If the number is found in the vector, it removes that number. Otherwise, it generates a message.




Empty(vector<int &num)



Erases all the existing numbers from the vector.




Count(vector<int &num)



Counts the total available numbers in the vector.




Show(vector<int &num)



Show the existing members of the vector (order does not matter). It will generate a message if there is no existing member available.




Do not use any global variable. Write necessary lines to test your code. Submit one cpp file in the blackboard.

More products