Write a program that inputs numeric values from 1 through 10 and outputs a textual histogram of the values using *'s to count dre number of occurrences of each value. The program should first ask the user how many numbers to enter. If the user enters a value that does not consist of all digits or a number outside the range 1 to 10, then an exception should be caught. [Hint: Input each number as a string, and then scan through the string to see if it contains all digits. If not, throw an exception. To convert a string str to an integer, use the following code:
atoi(str.c_str());
The atoi function is described in Chapter 8.) Here is a sample dialogue:
How many numbers to enter?
5
Enter number 1 L
one
Please enter your number using digits only. Try again.
Enter number 1:
9
Enter number 2:
3
Enter number 3:
3
Enter number 4:
33
The number must be between 1–10. Try again. Enter number 4:
3
Enter number 5:
7
Here is the histogram of values:
1 :
2 :
3: ***
4:
5:
6:
7: *
8:
9 : *
10:
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.