/**
读入两个数h,m
判断m是否为0
m为0,输出 h o'clock
m不为0,输出 h 和 m 对应的英文
判断h,m对应的英文:
开辟结构体数组数组0-61
0-23存入结构体数组
30,40,50存入数组
其他数字取余和取整求出
*/
#include <iostream>
using namespace std;
struct shiJian
{
int mark=0;
string EnglishTime;
}a[60];
void assignment()
{
a[0].EnglishTime="zero";
a[0].mark=1;
a[1].EnglishTime="one";
a[1].mark=1;
a[2].EnglishTime="two";
a[2].mark=1;
a[3].EnglishTime="three";
a[3].mark=1;
a[4].EnglishTime="four";
a[4].mark=1;
a[5].EnglishTime="five";
a[5].mark=1;
a[6].EnglishTime="six";
a[6].mark=1;
a[7].EnglishTime="seven";
a[7].mark=1;
a[8].EnglishTime="eight";
a[8].mark=1;
a[9].EnglishTime="nine";
a[9].mark=1;
a[10].EnglishTime="ten";
a[10].mark=1;
a[11].EnglishTime="eleven";
a[11].mark=1;
a[12].EnglishTime="twelve";
a[12].mark=1;
a[13].EnglishTime="thirteen";
a[13].mark=1;
a[14].EnglishTime="fourteen";
a[14].mark=1;
a[15].EnglishTime="fifteen";
a[15].mark=1;
a[16].EnglishTime="sixteen";
a[16].mark=1;
a[17].EnglishTime="seventeen";
a[17].mark=1;
a[18].EnglishTime="eighteen";
a[18].mark=1;
a[19].EnglishTime="nineteen";
a[19].mark=1;
a[20].EnglishTime="twenty";
a[20].mark=1;
a[21].EnglishTime="twenty one";
a[21].mark=1;
a[22].EnglishTime="twenty two";
a[22].mark=1;
a[23].EnglishTime="twenty three";
a[23].mark=1;
a[24].EnglishTime="twenty four";
a[24].mark=1;
a[30].EnglishTime="thirty";
a[30].mark=1;
a[40].EnglishTime="forty";
a[40].mark=1;
a[50].EnglishTime="fifty";
a[50].mark=1;
}
int main()
{
int h,m;
cin>>h>>m;
assignment();
if(m==0)
cout<<a[h].EnglishTime<<" "<<"o'clock"<<"\n";
else
{
if(a[m].mark==1)
cout<<a[h].EnglishTime<<" "<<a[m].EnglishTime<<"\n";
else
cout<<a[h].EnglishTime<<" "<<a[m-m%10].EnglishTime<<" "<<a[m%10].EnglishTime<<"\n";
}
return 0;
}
12-24
64
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-02
1344
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-12