就爱无名 @ 2017-06-01 13:22:44
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string a[7];
string b[22]={"zero","one","two","three","four","five",
"six","seven","eight","nine","ten","eleven", "twelve","thirteen","fourteen","fifteen",
"sixteen","seventeen","eighteen","nineteen","twenty"};
int c[7];
int main(){
int num=0;
for(int i=1;i<=6;i++){
cin>>a[i];
a[i][0]=tolower(a[i][0]);//第一个字符可能大写 转成小写
for(int j=0;j<=20;j++){
if(a[i]==b[j]){
c[i]=j;
num++;
break;
}
}
}
//个位放前面少一位(开头为0去0) 一定小
//剩下的都看作二位数(占两位) 个位数最高位为0 最小
//总之从小到大排
int min=999;
int p;
for(int i=1;i<=num;i++){
for(int j=1;j<=num;j++){
if(min>c[j]){
min=c[j];
p=j;
}
}
min=999;
c[p]=999;
//cout<<min;
if(min==0)continue;
else if(i!=1&&min<10)cout<<"0"<<min;
else cout<<min;
}
return 0;
}
by 曾今的我 @ 2017-06-01 13:31:50
不知道你要问啥???!!!
。。。。。
by pzx1466145162 @ 2017-06-01 13:41:33
你想说什么?
by ABCDXYZ @ 2017-06-01 16:12:07
@pzx1466145162 是<cstring>吧