解题思路:
注意事项:
参考代码:
#include <stdio.h>
#include <string.h>
//二十以内的数字;
char arr[25][20]={"zero","one","two","three","four","five","six","seven","eight","nine","ten",
"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
//超过二十的数字;
char arr1[10][10]={"thirty","forty","fifty"};
int main()
{
int h,m; //小时 与 分钟;
scanf ("%d %d",&h,&m);
if (h<=20)
{
printf ("%s ",arr[h]);
}else {
printf ("%s %s ",arr[h-h%10],arr[h%10]);
}
if(m==0)
{
printf("o'clock");
}else if (m<=20){
printf ("%s",arr[m]);
}else if(m<=30){
printf ("%s %s",arr[m-m%10],arr[m%10]);
}else{
printf ("%s %s",arr1[m/10-3],arr[m%10]);
}
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:674 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码) 用函数传参的方法浏览:4120 |
模拟计算器 (C语言代码)浏览:966 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:543 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:577 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)万恶的long long浏览:907 |
【偶数求和】 (C语言代码)浏览:588 |
1011题解浏览:819 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:1483 |
星期判断机 (C语言代码)浏览:892 |