Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C++
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
   int n;
   cin>>n;
   cout<<endl;
   int* a;
   a=new int [n];

   for(int i=0; i<n;>
    {cin>>a[i];
}
sort(a,a+n);
for(int i=0; i<n;>
{
   cout<<a[i]<<endl;
}
return 0;
}</algorithm></iostream>
Posted
Updated 11-Dec-14 3:09am
v5
Comments
chandanadhikari 4-Dec-14 1:48am    
i just formatted your code and did not omit anything but still some pieces seem to be missing. Kindly update the code.
Jochen Arndt 4-Dec-14 2:58am    
The posted code would not compile. You should edit your question to show the real content of these incomplete lines:
for(int i=0; i<n;>
Richard MacCutchan 4-Dec-14 3:52am    
Your for loop never terminates, you should change it to for(int i=0; i < n; ++i)
ZurdoDev 4-Dec-14 7:44am    
Looks like a solution to me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900