-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclock problem.cpp
More file actions
57 lines (55 loc) · 1.32 KB
/
Copy pathclock problem.cpp
File metadata and controls
57 lines (55 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <bits/stdc++.h>
using namespace std;
int main()
{
int hr,min;
cin>>hr;
cin>>min;
const char *args[] ={
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"eleven",
"twelve",
"thirteen",
"fourteen",
"quarter",
"sixteen",
"seventeen",
"eighteen",
"nineteen",
"twenty",
"twenty one",
"twenty two",
"twenty three",
"twenty four",
"twenty five",
"twenty six",
"twenty seven",
"twenty eight",
"twenty nine",
"half"
};
vector<string> numbers(args, args + sizeof(args)/sizeof(args[0]));
if(min==00)
cout<<numbers[hr]+" o' clock"<<'\n';
else if(min==15 || min ==30)
cout<<numbers[min]+" past "+numbers[hr]<<'\n';
else if(min==1)
cout<<numbers[min]+" minute past "+numbers[hr]<<'\n';
else if(min>=02 && min <=30)
cout<<numbers[min]+" minutes past "+numbers[hr]<<'\n';
else if(min==45)
cout<<"quarter to "+numbers[hr+1]<<'\n';
else
cout<<numbers[60-min]+" minutes to "+numbers[hr+1]<<'\n';
return 0;
}