解题思路:
注意事项:
参考代码:#include <cstdio>int main(){
char *num[]= {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","thirty","forty","fifty"};
int n,m;
scanf("%d%d",&n,&m);
if(n<21)
printf("%s ",num[n]);
else
{
int a=n%10;
printf("twenty %s ",num[a]);
}
if(m==0)
printf("o'clock");
else if(m<21)
printf("%s ",num[m]);
else
{
int a=m%10,b=m/10;
if(a==0)
{
if(b==2)
printf("%s",num[20]);
else if(b==3)
printf("%s",num[21]);
else if(b==4)
printf("%s",num[22]);
else if(b==5)
printf("%s",num[23]);
}
else
{
if(b==2)
printf("%s %s",num[20],num[a]);
else if(b==3)
printf("%s %s",num[21],num[a]);
else if(b==4)
printf("%s %s",num[22],num[a]);
else if(b==5)
printf("%s %s",num[23],num[a]);
}
}
return 0;}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:798 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:1110 |
WU-整数平均值 (C++代码)浏览:1307 |
1124题解浏览:630 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:1968 |
蛇行矩阵 (C语言代码)浏览:559 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:653 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:593 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:504 |
马拦过河卒 (C语言代码)浏览:1213 |