#include <iostream>
#include <stdio.h>
using namespace std;
void swap(int &a, int &b){
int c = a;
a = b;
b = c;
}
int main(){
int a,b,c,d,e;
cout<<"Input 5 numbers
";
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
do{
if(d > e) swap(d,e);
if(c > d) swap(c,d);
if(b > c) swap(b,c);
if(a > b) swap(a,b);
} while (! ((a <= b) && (b <= c) && (c <= d) && (d <= e)) ) ;//while not sorted
cout<<a<<b<<c<<d<<e<<endl;
system("pause");
return 0;
}
Comments
Leave a comment