Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions