Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need to male a program in c++ to order the values enter from the user to lowest

ID: 3796825 • Letter: N

Question

Need to male a program in c++ to order the values enter from the user to lowest to high with this functions
We have two new functions:

// new function here, swap, will swap two values for us
// the ampersand (&) is "pass by ref"
void swap( float &A, float &B );
// function that takes three floats and puts them in numeric order (lowest to highest)
void sort( float &m, float &n, float &o );

complete the sort function so that after using it, for example,

float x = 6, y = 2, z = 9;
sort( x, y, z );

// will make x = 2, y = 6, z = 9

Explanation / Answer

#include <iostream>

using namespace std;
void sort1(int &a,int &b,int &c);

int main()
{
int a,b,c;
cout<<"Enter the numbers:";
cin>>a>>b;
cout<<"Number before swap"<<a<<b;
swap(a,b);
cout<<"Number after swap"<<a<<b;
cout<<"Enter the numbers:";
cin>>a>>b>>c;
cout<<"Number before sort"<<a<<b<<c;
sort1(a,b,c);
cout<<"Number after sort"<<a<<b<<c;
return 0;
}

void swap(int &a,int &b)
{
int temp=0;
temp=a;
a=b;
b=temp;
  
}

void sort1(int &a,int &b,int &c)
{

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote