Question: Please edit the following C++ program using the for loop to repeat the process of sorting at least 3 times. #include using namespace std; int

Please edit the following C++ program using the for loop to repeat the process of sorting at least 3 times.

#include

using namespace std;

int main()

{

bool Continue=1;

int a;

int b;

int c;

while (Continue==1)

{

cout << "Type three numbers"<< endl;

cin >> a >> b >> c;

if(a < b && b < c)

{

cout << "Lowest to highest" << endl;

cout << a <<" "<< b <<" "<< c << endl;

}

if (b < a && a < c)

{

cout << "Lowest to highest" << endl;

cout << b <<" "<< a <<" "<< c << endl;

}

if (a < c && c < b)

{

cout << "Lowest to highest" << endl;

cout << a <<" "<< c <<" "<< b << endl;

}

if (b < c && c < a)

{

cout << "Lowest to highest" << endl;

cout << b <<" "<< c <<" "<< a << endl;

}

if (c < b && b < a)

{

cout << "Lowest to highest" << endl;

cout << c <<" "<< b <<" "<< a << endl;

}

if (c < a && a < b)

{

cout << "Lowest to highest" << endl;

cout << c <<" "<< a <<" "<< b << endl;

}

//descending

if(a > b && b > c)

{

cout << "Highest to Lowest" << endl;

cout << a <<" "<< b <<" "<< c << endl;

}

if (b > a && a > c)

{

cout << "Highest to Lowest" << endl;

cout << b <<" "<< a <<" "<< c << endl;

}

if (a > c && c > b)

{

cout << "Highest to Lowest" << endl;

cout << a <<" "<< c <<" "<< b << endl;

}

if (b > c && c > a)

{

cout << "Highest to Lowest" << endl;

cout << b <<" "<< c <<" "<< a << endl;

}

if (c > b && b > a)

{

cout << "Highest to Lowest" << endl;

cout << c <<" "<< b <<" "<< a << endl;

}

if (c > a && a > b)

{

cout << "Highest to Lowest" << endl;

cout << c <<" "<< a <<" "<< b << endl;

}

cout<< "Would you like to continue? Enter 1 for yes and 0 for no." <

cin>>Continue;

}

system("pause");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!