解题思路:将题干中出现的数字的英文单词对应储存在数组中,再对应输出
注意事项:
参考代码:
#include<stdio.h>
int main()
{
char *a[60]={"zero","one","two","three","four","five","six","seven","eight","nine","ten",
"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
a[30]="thirty";
a[40]="forty";
a[50]="fifty";
int h,m;
int h1,m1;
scanf("%d%d",&h,&m);
if(m==0)
printf("%s o'clock",a[h]);
else
{
if(h<21)
printf("%s ",a[h]);
else
{
h1=h%10;
h=h-h1;
printf("%s %s ",a[h],a[h1]);
}
if(m<21)
printf("%s",a[m]);
else
{
m1=m%10;
m=m-m1;
if(m1!=0)
printf("%s %s",a[m],a[m1]);
else
printf("%s",a[m]);
}
}
return 0;
}
0.0分
2 人评分
程序员的表白 (C语言代码)浏览:706 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:674 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:5274 |
简单的a+b (C语言代码)浏览:626 |
sizeof的大作用 (C语言代码)浏览:1138 |
简单的a+b (C语言代码)浏览:444 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:710 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:630 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:680 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:405 |