解题思路:
注意事项:
参考代码:
#include<iostream>
#include<string>
#include<algorithm>
#include<string>
#include <ctype.h>
using namespace std;
char a[21][10]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven",
"twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
void display(int k){
if(k<=20)
cout<<a[k];
else{
int n = k/10;
int m = k %10;
if(n == 2)
cout<<a[20];
else if(n == 3)
cout<<"thirty";
else if(n == 4)
cout<<"forty";
else
cout<<"fifty";
cout<<' '<<a[m];
}
}
int main(){
int h,m;
cin>>h>>m;
if(m == 0){
display(h);
cout<<" o'clock"<<endl;
}
else{
display(h);
cout<<" ";
display(m);
cout<<endl;
}
return 0;
}
0.0分
0 人评分
C语言考试练习题_排列 (C++代码)浏览:1089 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:756 |
简单的a+b (C语言代码)浏览:623 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:705 |
用筛法求之N内的素数。 (C语言代码)浏览:1235 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:507 |
哥德巴赫曾猜测 (C语言代码)浏览:2319 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:633 |
1014题解浏览:484 |
妹子杀手的故事 (C语言代码)浏览:1049 |