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
Evgesh-ka [11]
3 years ago
8

Write a function called order() thattakes three parameters, and rearranges the integers referred to sothat the largest is first,

then the next largest, and finally thesmallest
Computers and Technology
1 answer:
gogolik [260]3 years ago
4 0

Answer: The c++ program to implement order() method is given below.

#include <iostream>

using namespace std;

void order(int a, int b, int c);

int main() {

   int x, y, z;

   cout<<"This program displays numbers in descending order."<<endl;

   do

   {

       cout<<"Enter first number"<<endl;

       cin>>x;

       if(x<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(x<0);

   do

   {

       cout<<"Enter second number"<<endl;

       cin>>y;

       if(y<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(y<0);

   do

   {

       cout<<"Enter third number"<<endl;

       cin>>z;

       if(z<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(z<0);

   order(x, y, z);

   return 0;

}

void order(int a, int b, int c)

{

   if((a>b)&&(a>c))

   {  

       cout<<"Numbers in decreasing order are"<<endl;

       cout<<a<<endl;

           if(b>c)

           {

               cout<<b<<endl;        

               cout<<c<<endl;

           }

           else

           {

               cout<<c<<endl;

               cout<<b<<endl;

           }

   }    

   if((b>a)&&(b>c))

   {  

       cout<<"Numbers in decresing order are"<<endl;

       cout<<b<<endl;

           if(a>c)

           {

               cout<<a<<endl;        

               cout<<c<<endl;

           }

           else

           {

               cout<<c<<endl;

               cout<<a<<endl;

           }

   }    

   if((c>b)&&(c>a))

   {  

       cout<<"Numbers in decreasing order are"<<endl;

       cout<<c<<endl;

           if(a>b)

           {

               cout<<a<<endl;        

               cout<<b<<endl;

           }

           else

           {

               cout<<b<<endl;

               cout<<a<<endl;

           }

   }

       

}

OUTPUT

This program displays numbers in descending order.

Enter first number

12

Enter second number

-9

Invalid input. Enter a positive number.

Enter second number

0

Enter third number

55

Numbers in decreasing order are

55

12

0

Explanation:

The method order() is declared as follows.

void order(int a, int b, int c);

The method is declared void since it does not return any value.

This program is designed to accept 0 and positive integers only. This is implemented by do-while loop while taking user input.

The program uses 3 integer variables to store the user input.

int x, y, z;

The method order() is designed to accept 3 integer parameters. This method is called once user enters valid input.

order(x, y, z);

These numbers are compared in order to display them in descending order.

No variable is used for comparison. The method simply compares the numbers and displays them using multiple if-else statements.

You might be interested in
How was the addition of an improvement over early web design?
Vinil7 [7]

Answer:

Early web designs were text oriented.

Explanation:

So the beginning is text and now as the technology has drastically grown the web design also incorporated multimedia like text, audio, video, graphics and animation.

As the improvement started the number visitors, creativity in the content creation, competitiveness and all the other aspect made website creation and design a mandatory factor for any business to grow. How the web design is, it decides the number of visitors and the way the user interacts.

3 0
3 years ago
Software that interprets commands from the keyboard and mouse is also known as the what?
7nadin3 [17]
Out of the ones that you mention, the correct answer should be 
<span> Operating system</span>
3 0
3 years ago
Read 2 more answers
Julie is using the element of design.
-BARSIC- [3]

Answer:

Julie is using sand element of design

Explanation:

5 0
3 years ago
You have recently been hired as the staff attorney at a growing independent film studio in Van Nuys, California. Among your duti
expeople1 [14]

Answer: dude it’s all mussed in where the question

Explanation:

4 0
3 years ago
Brent sold 17/20 case of tennis balls on Monday and 7/10 case on Tuesday. how many more tennis balls dis he sell on Monday than
ivanzaharov [21]

3/20

Explanation:

You find the difference between the number of tennis case sold on Monday and Tuesday

6 0
4 years ago
Other questions:
  • What are the three fundamental elements of an effective security program for information systems?
    11·2 answers
  • ____ convert a program design developed by a systems analyst or software developer using one of many computer languages.
    10·1 answer
  • The quality of a language that allows a programmer to express a computation clearly, correctly, concisely, and quickly is called
    7·1 answer
  • What happens once the Insert tab is used in PowerPoint to insert a chart into a presentation?
    7·1 answer
  • Which of the following is the correct ordering of operating systems, oldest to newest?
    5·2 answers
  • Identify the benefit of modeling to communicate a solution.
    10·1 answer
  • Which 1898 film did George Melies create using camera trickery to create a illusion in which we now
    11·1 answer
  • MULTIPLE COICE! BRAINLIEST
    12·1 answer
  • 7. Explain the steps for formatting a shape ?
    5·1 answer
  • a value-returning method must specify as its return type in the method header. question 18 options: a) an int b) a double c) a b
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!