Write a function named sortie that takes three integer parameters by reference and rearranges them in ascending order--the first parameter being the smallest, the third parameter being the largest. A program file is provided. A comment in the file indicates where the function should be written.

Answer :

Write a function named sortie that takes three integer parameters by reference and rearranges them in ascending order--the first parameter being the smallest, the third parameter being the largest.

Explanation:

#include <stdio.h>

using namespace std;

int main()

{

cout<<"Enter 3 number";

int first, second, third;

cin>>first>>second>>third;

cout<<endl;

cout<<"Unsorted :"<<first<<","<<second<<","<<third<<endl;

sortie(first,second,third);

cout<<"Sorted :"<<first<<","<<second<<","<<third<<endl;

return 0;

}

  • Three numbers are inputted from the user.
  • Sortie function is used to sort the data in specified places.

Other Questions