Kat H.

asked • 04/05/21

C++. Write a program that reads three integers from cin and outputs them in order from smallest to largest.

C++.


Write a program that reads three integers from cin and outputs them in order from smallest to largest.

Example: input of 3 8 5 should result in output of:

3 5 8


Hints:

  1. You do not have to actually "sort" the values, just print them in the right order.
  2. You are going to have to use nested if/else statements or && to solve this.
  3. To put a space between numbers, print " ". Like: cout << a << " " << b;


Code:


#include <iostream>

using namespace std;


int main()

{

//YOUR_CODE

}

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.