77 902
Assignments Done
98,6%
Successfully Done
In August 2019

Answer to Question #47952 in C++ for edzel

Question #47952
How to sort in ascending mode
Expert's answer
Solution.

//Connectinglibrary
#include<iostream>
usingnamespace std;

intmain()
{
inta[10], swap;
for (int i = 0; i < 10; ++i )
{
cout <<endl<< "Enter thenumber: ";
cin>> a;
}

for (int i = 0; i < 10; ++i )
{
for( int j = i; j < 10; ++j )
{
if(a[j] < a[i] ) // ascending
{
swap= a[i];
a[i]= a[j];
a[j]= swap;
}
}
}

cout <<endl<< "Result:";
for ( int i = 0; i < 10; ++i )
{
cout << a[i] << " ";
}

cin.get();
//system(“pause”);
return 0;
}[i]



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions