解题思路:
注意事项:
参考代码:
#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 人评分
点我有惊喜!你懂得!浏览:2072 |
C语言训练-谁家孩子跑最慢* (C语言代码)浏览:1508 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1039 |
大小写转换 (C语言代码)浏览:859 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:567 |
三角形 (C语言代码)浏览:914 |
简单的a+b (C语言代码)浏览:488 |
关于float,double变量的几点说明浏览:1812 |
IP判断 (C语言代码)浏览:539 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:676 |