Question: create a c + + program. Make a program that will read an unknown number of ages. ( 0 is a valid age used for

create a c++ program.
Make a program that will read an unknown number of ages. (0 is a valid age used for a baby.) The user will
enter a negative number if there are no more ages to enter. The program will output the average age, the
number of minors (less than 18), the number of adults (18 and above) and the youngest and oldest ages. If
no ages were entered, display No ages were entered(see the last test case below). You dont need to use
fixed << setprecision(x) for the average.
Test cases
[kslott@empress cs111_lec_spr11]$ ./a.out
Enter an age: 20
Enter an age: 0
Enter an age: 10
Enter an age: 5
Enter an age: -1
One space
8.75(average)
3(minors)
1(adults)
20(oldest)
0(youngest)
[kslott@empress cs111_lec_spr11]$ ./a.out
Enter an age: 101
Enter an age: 105
Enter an age: -5
103(average)
0(minors)
2(adults)
105(oldest)
101(youngest)
[kslott@empress cs111_lec_spr11]$ ./a.out
Enter an age: 10
Enter an age: -9
10(average)
1(minors)
0(adults)
10(oldest)
10(youngest)
[kslott@empress cs111_lec_spr11]$ ./a.out
Enter an age: 0
Enter an age: 0
Enter an age: -2
0(average)
2(minors)
0(adults)
0(oldest)
0(youngest)
[kslott@empress cs111_lec_spr11]$ ./a.out
Enter an age: -1
No ages were entered
[kslott@empress cs111_lec_spr11]$

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!