题解
2025-05-09 17:36:52
发布于:浙江
8阅读
0回复
0点赞
思路:定义一个字符串数组,然后用sort排序即可
代码:
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
string a[15]={};
for(int i=1;i<=n;i++)cin >> a[i];
sort(a+1,a+n+1);
for(int i=1;i<=n;i++)cout << a[i]<<" ";
return 0;
}
这里空空如也
有帮助,赞一个