解题思路:
注意事项:
1.英文单词的书写
2.输出格式
参考代码:
#include<iostream> using namespace std; void exchange2(int d) { switch(d) { case 0:cout<<"zero";break; case 1:cout<<"one";break; case 2:cout<<"two";break; case 3:cout<<"three";break; case 4:cout<<"four";break; case 5:cout<<"five";break; case 6:cout<<"six";break; case 7:cout<<"seven";break; case 8:cout<<"eight";break; case 9:cout<<"nine";break; case 10:cout<<"ten";break; case 11:cout<<"eleven";break; case 12:cout<<"twelve";break; case 13:cout<<"thirteen";break; case 14:cout<<"fourteen";break; case 15:cout<<"fifteen";break; case 16:cout<<"sixteen";break; case 17:cout<<"seventeen";break; case 18:cout<<"eighteen";break; case 19:cout<<"nineteen";break; case 20:cout<<"twenty";break; case 30:cout<<"thirty";break; case 40:cout<<"forty";break; case 50:cout<<"fifty";break; } } void exchange1(int n) { if(n<=20) exchange2(n); else { int i=n%10; n-=i; exchange2(n); cout<<' '; exchange2(i); } } int main() { int h,m; while(cin>>h>>m) { char a[10]; if(m!=0) { exchange1(h); cout<<' '; exchange1(m); } else { exchange1(h); cout<<' '<<"o'clock"<<endl; } } return 0; }
0.0分
4 人评分