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
When purchasing a mobile computer, you should determine the form factor that meets your needs. What is a form factor?
Ilia_Sergeevich [38]

Answer:

A FORM FACTOR is the shape, size/dimension and all physical specifications of an electronic device. It refers to the hardware in computers.

It determines the compatibility of several devices despite the manufacturer.

Examples of motherboard form factors include:

- ATX: this is the most common motherboard form factor for desktop computers today

- AT

-BTX

-DTX

-ITX

-Full AT

-Full ATX

-Micro-ITX

-MicroATX

-Mobile-ITX

8 0
3 years ago
Question 2 Multiple Choice Worth 5 points)
Finger [1]

Answer:

Answer:much faster than Humans can

4 0
3 years ago
The operating system provides a ____, which is the means with which you interact with the computer
Soloha48 [4]
One answer could be a GUI = Graphical User Interface (e.g. Windows Explorer).
4 0
4 years ago
Clickable text or images that take you to different sites on the World Wide Web are called __________.
andrew-mc [135]

they are called links my dear watson

6 0
3 years ago
Read 2 more answers
What does XML do with a data wrapped in the tags?
Arlecino [84]

Answer:

Especificación para diseñar lenguajes de marcado, que permite definir etiquetas personalizadas para descripción y organización de datos. ¿Para que sirve XML? Representar información estructurada en la web (todos documentos), de modo ... Las etiquetas se definen para crear los documentos, no tienen un significado

Explanation:

5 0
3 years ago
Other questions:
  • Theâ ______ is a large worldwide collection of networks that use a common protocol to communicate with one another.
    5·1 answer
  • The part of the inside of a computer
    14·1 answer
  • What is the term for individual computers and devices that are connected to a network?
    14·1 answer
  • How do I convert a number into a percentage in excel
    7·1 answer
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    8·1 answer
  • As part of the interview process should you compose a thank-you note for the prospective employer and/or interview committee. In
    6·1 answer
  • 5. How is shutter speed generally measured? What do the measurements mean?
    7·2 answers
  • Does anyone take bca on plato
    11·1 answer
  • Look at (d), is it accurate? ​
    9·2 answers
  • A qué escala está dibujado el plano del Instituto si sabemos que la puerta principal de entrada tiene un ancho 3,40 metros y en
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!