昨天一个学长大佬交了我们sort排序。个人感觉还挺好的,代码也不难。学长着实厉害,希望未来也能成为像他们一样的人。
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
1 #include<bits/stdc++.h>
2 using namespace std;
3 int main()
4 { int x=-1;
5 bool flag=0;
6 char a[555],b[251],c[521];
7 cin.getline(a,555);
8 for(int i=0;i<=strlen(a);i++)
9 { flag=0;
10 if(a[i]==' ' || a[i]=='\0')
11 {
12
13 if(a[i-1]!=' ')
14 {
15 for(int j=i-1;j>=x+1;j--)
16 {
17 cout<<a[j];
18 }
19 cout<<" ";
20 }
21 else cout<<" ";
22 x=i;
23 }
24 }
25 }
26
View Code
}
else cout<<" ";
x=i;
}
}
}