3) The process of finding the largest and smallest numbers is used frequently in
ID: 3616484 • Letter: 3
Question
3) The process of finding the largest and smallest numbers is used
frequently in computer applications.
Write a C++ program that uses a while statement to determine and
print the largest and the second largest
number of x integers entered by the user, where x should also be input
by the user.
Data set Largest1 Largest2
======== ======== ========
9,9 9 9
9,9,7 9 7
9,9,9,9,9,7,8 9 8
1,1,1,1,8,6 8 6
(i)
How many numbers do you want to enter? 3
Please enter an integer number 1 9
Please enter an integer number 2 9
Please enter an integer number 3 7
The largest is 9
The Second largest is 7
(ii)
How many numbers do you want to enter? 6
Please enter an integer number 1 1
Please enter an integer number 2 1
Please enter an integer number 3 1
Please enter an integer number 4 1
Please enter an integer number 5 8
Please enter an integer number 6 6
The largest is 8
The Second largest is 6
Note: In your output, please contain all four data sets as given above in
the table.
Explanation / Answer
please rate - thanks #include using namespace std; int main() {int first=-99999,second=-99999,number,count=0,max; coutmax; while(countRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.