LAB 4: Due 11:59 pm, Mon Sep 27
Submit the link to your project to Moodle before the deadline. Do Not modify after the deadline.
PartI: Do programming exercises 3, 4, 5, and 6 at the end of chapter 4. Write a single test program for all of these tasks but make sure you test each function/task separately and fully, and provide the user a good interface (that should include the option of repeating computations). Some hints:
template < class elemType>
void reverseVector(vector<elemType> &list)
{
typename vector<elemType> : : iterator Itr1,Itr2;
..... FILL IN THE REST
}
Part II: Write a program that uses the map template class from STL to compute a histogram of positive numbers entered by the user. The map's key should be the number that is entered, and the value should be a counter of the number of times the key has been entered so far. Use -1 as a sentinel value to signal the end of user input. For exampe, if the user inputs:
5,12,3,5,5,3,21
then the program should output the following (not necessarily in this order):
The number 3 occurs 2 times.
The number 5 occurs 3 times.
The number 12 occurs 1 times.
The number 21 occurs 1 times.
The program should let the user enter as many (multi)sets of numbers as they want.