I am new in programming. I have this problem in coding. i somehow have the idea but i could not simply do it in codes. can anyone add to complete my program.

The problem is I enter 10 numbers and i need to sort them ascendingly.

#include<iostream>
using namespace std;
int main()
{
int n[10],i;
cout<<"Enter 10 Numbers: ";
for(i=0;i<10;i++)
cin>>n;


system("pause>0");
}

I do not know the proceeding codes. can anyone help me to figure this out?
It would be a big help thanks in advance!

Edited:

Ok, just getting the set of numbers. Example, i entered 10 numbers

1
2
3
4
4
4
5
1
1
2

Output:
The set of number: {1,2,3,4,5}

how to get that?

Solution

# include <iostream>
using namespace std;
int main()
{
	int n[10];
	int i;
	int t;
	for( int i=0;i<10;i++) {
		cin>>n[i]; }
	for ( int i=0;i<9;i++) { 
		if(n[i]>n[i+1]) {
			t=n[i+1];
			n[i+1]=n[i];
		}
		cout<<n[i]<<" ";
	}
	return 0;
}
commented: Please follow the site guidlines and only give help to those that show effort -2

Solution

# include <iostream>
using namespace std;
int main()
{
	int n[10];
	int i;
	int t;
	for( int i=0;i<10;i++) {
		cin>>n[i]; }
	for ( int i=0;i<9;i++) { 
		if(n[i]>n[i+1]) {
			t=n[i+1];
			n[i+1]=n[i];
		}
		cout<<n[i]<<" ";
	}
	return 0;
}

Bro! thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.