1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LekaFEV [45]
3 years ago
13

C++ program: Write a program that prompts the user to input three numbers. The program should then output the numbers in ascendi

ng order, separated by a single space.
Computers and Technology
1 answer:
Lelechka [254]3 years ago
3 0

Answer:

// here is code in C++.

#include<iostream>

using namespace std;

int main()

{

// declare variables

  double num1, num2, mun3, t;

  cout << "Enter three numbers: ";

// read the three numbers

  cin >> num1 >> num2 >> mun3;

  //sort the three numbers

  if( num1>num2 )

  {

     t = num1;

     num1 = num2;

     num2 = t;}

  if( num2>mun3 ){

     t = num2;

     num2 = mun3;

     mun3 = t;}

  if( num1>num2 ){

     t = num1;

     num1 = num2;

     num2 = t;

  }

  // print the output

  cout<<"numbers in ascending order:";

  cout << num1 << " " << num2 << " " << mun3 << endl;

  return 0 ;

}

Explanation:

Declare three variables to store the input. Read the value of all three variables. If first number is greater than second, then with the help of variable "t" swap the  value of first and second.after that if second is greater than third number, swap them.In last if first number is greater than second one then swap them. This will sort the three numbers in ascending order.

Output:

Enter three numbers: 3 7 2                                                                                                

numbers in ascending order:2 3 7

You might be interested in
Why did Herman Hollerith invent the Tabulating Machine?
Anvisha [2.4K]

Answer:

the machine was developed to help process data for the 1890 U.S. Census.

Explanation:

U.U

8 0
3 years ago
Introduction to graphic design please help! Define the four terms: design ,art,decoration , and visual literacy. Describe how th
erastovalidia [21]
Graphic design involves activities , usually done on the computer in which pictures, graphs, text and other elements are combined as a edit to books, magazines, advertisements. 
Activities which are part from this job are:
Design: the creation of ideas, plans and finally creation of object, pictures,...
Art: expressing the imagination through different ways of expression/ 
Decoration: adding something to the graphic design in order to look and act nicer
Visual literacy: the ability to understand existing trends and to learn new ones
8 0
4 years ago
1. Import it into Eclipse. Open the file in Eclipse 2. Edit the file to add comments to identify the instance variables, constru
natita [175]

Answer:

/

Explanation:

3 0
3 years ago
In a transaction-processing system (tps), if the tps database can be queried and updated while the transaction is taking place,
Alona [7]
This is called Real time processing. A Transaction Processing System (TPS) is a kind of data framework that gathers, stores, adjusts and recovers the information exchanges of an undertaking. Exchange handling frameworks additionally endeavor to give unsurprising reaction times to demands, despite the fact that this is not as basic with respect to continuous frameworks.
6 0
3 years ago
Why does it still say I am ambitious whenever I have the 5 brainliest and almost 700 points?
Galina-37 [17]
Check below your score it should say something out of 5 you need to get more to get 5/5
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is similar to defense in depth and supports multiple layers of security?a. Defense in depthb. Diversity o
    7·1 answer
  • Who is the CEO of Tesla.​
    11·2 answers
  • PLEASE HELP!!!!!!!!!!!!!!!!!!!!
    13·1 answer
  • Why is an array like a list? How do you identify and find elements in an array? Explain the purpose of a try-catch block and giv
    5·1 answer
  • Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First method named as 'set
    6·1 answer
  • Which statement assigns the value 98 to the variable myScore in Python?
    14·2 answers
  • Write down a scratch program which:
    5·1 answer
  • What is the function of the operating system of a computer?
    14·1 answer
  • A database admin uses a SHOW statement to retrieve information about objects in a database. This information is contained in a _
    10·1 answer
  • A(n) _____ is a data validation rule that should be applied to mandatory data items.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!