-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuri 2137.c
47 lines (46 loc) · 976 Bytes
/
uri 2137.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
string a[n];
char x[5];
int A[n];
int J=0,min=1;
for(int i=0; i<n; i++,J++)
{
cin>>x;
a[i]=x;
A[J]=atoi(x);
}
int k=0;
while(k<J-1)
{
int ptr=0;
while(ptr<J-k-1)
{
if(A[ptr]>A[ptr+1])
{
int temp;
temp=A[ptr];
A[ptr]=A[ptr+1];
A[ptr+1]=temp;
string x;
x=a[ptr];
a[ptr]=a[ptr+1];
a[ptr+1]=x;
}
ptr++;
}
k++;
}
for(int i=0; i<J; i++)
{
cout<<a[i]<<endl;;
}
}
return 0;
}