Question: please use C++ program and #include and #include Write a program that takes in a sequence of integers, and prints the second largest number and

please use C++ program and #include and #include

please use C++ program and #include and #include Write a program that

Write a program that takes in a sequence of integers, and prints the second largest number and the second smallest number. Note that in the case of repeated numbers, we really mean the second largest and smallest out of the distinct numbers (as seen in the examples below). You may only use the headers: and . Please have the output formatted exactly like the following examples: (the red is user input) Enter integers (Q to quit): 1 2 1 8 8 9 Q Second largest: 8 Second smallest: 2 Enter integers (Q to quit): -7 -101 0 -2 17 Q Second largest: 0 Second smallest: -7 Enter integers (Q to quit): 1 1 2 2 Q Second largest: 1 Second smallest: 2 Enter integers (Q to quit): 1 Q Second largest: 1 Second smallest: 1 No invalid inputs: You do NOT have to worry about the user giving invalid inputs like characters except Q, really large numbers, etc. - You may not use stdafx .h

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!