- #1
mdnazmulh
- 51
- 0
i have to write such a program that takes 10 integers from user and show them in ascending order.
My attempt was ---
#include<iostream.h>
#include<conio.h>
int main()
{
int a[10];
for(int i=0; i<10; i++) //this loop is used for getting the 10 integers from user
cin>>a;
...... // here I'm stuck. I couldn't find how should i sort them. I can sort
// number using 'if..else if' statement which makes the program lengthy
// for this propblem.
getch();
return 0;
}
So please help me if anyone knows how to sort 10 integers so that it doesn't make the codes lengthy.
thanks in advance
My attempt was ---
#include<iostream.h>
#include<conio.h>
int main()
{
int a[10];
for(int i=0; i<10; i++) //this loop is used for getting the 10 integers from user
cin>>a;
...... // here I'm stuck. I couldn't find how should i sort them. I can sort
// number using 'if..else if' statement which makes the program lengthy
// for this propblem.
getch();
return 0;
}
So please help me if anyone knows how to sort 10 integers so that it doesn't make the codes lengthy.
thanks in advance