-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAR9.cpp
33 lines (31 loc) · 799 Bytes
/
AR9.cpp
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
#include<iostream>
#include<string.h>
using namespace std;
int main()
{int n; cin>>n;
char str[n][20], t[20];
int i, j;
for(i=0; i<n; i++)
{
// cout<<" ";
cin>>str[i];
}
for(i=1; i<n; i++)
{
for(j=1; j<n; j++)
{
if(strcmp(str[j-1], str[j])>0)
{
strcpy(t, str[j-1]);
strcpy(str[j-1], str[j]);
strcpy(str[j], t);
}
}
}
for(i=0; i<n; i++)
{
// cout<<" "<<endl;
cout<<str[i]<<endl;
}
return 0;
}