数组排序整理 + 循环语句
2023-08-05 17:15:21
发布于:上海
7阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
string cnt[14]={"3","4","5","6","7","8","9","10","J","Q","K","A","2","Joker"};
int find(string n){
for(int i=0;i<14;i++){
if(cnt[i]==n) return i;
}
}
int main(){
int n;
cin>>n;
string k[n];
int in[n];
for(int i=0;i<n;i++){
cin>>k[i];
in[i]=find(k[i]);
}
sort(in,in+n);
for(int i=0;i<n;i++) cout<<cnt[in[i]]<<" ";
return 0;
}
这里空空如也
有帮助,赞一个