解题思路:
注意事项:
参考代码:
#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 人评分