解题思路:
注意事项:
参考代码:
#include <cstdio> #include <iostream> using namespace std; string A[20] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}; string B[6] = {"", "", "twenty", "thirty", "forty", "fifty"}; int main(void) { int h,m; cin >> h >> m; if(h < 20) { cout << A[h] << " "; } else { int tmp = h % 10; int carry = h / 10; cout << B[carry] << " " ; if(tmp != 0) //20:20 cout << A[tmp] << " "; } if(m == 0) { cout << "o'clock"; } else if(m < 20) { cout << A[m] << " "; } else { int tmp1 = m % 10; int carry1 = m / 10; cout << B[carry1] << " "; if(tmp1 != 0) // 20:20 cout << A[tmp1] << " "; } return 0; }
0.0分
0 人评分
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:2468 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:664 |
【绝对值排序】 (C语言代码)浏览:717 |
这可能是一个假的冒泡法浏览:991 |
P1001 (C语言代码)浏览:801 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:338 |
1009题解浏览:752 |
母牛的故事 (C语言代码)浏览:551 |
数字游戏 (C++代码)浏览:1185 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:604 |