-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClocktest.cpp
More file actions
84 lines (79 loc) · 2.17 KB
/
Clocktest.cpp
File metadata and controls
84 lines (79 loc) · 2.17 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include<iomanip>
#include<string>
using namespace std;
class time()
{
int m,s,h;
void get(int p,int q, int r)
{
h=p;
m=q;
s=r;
}
void display()
{
}
void clock_12()
{
std::cout << h <<":" <<m<<":" <<s;
}
void clock_24(){
hh = h *10 + h%10;
}
}
int main(){
int p,q,r;
string clock_12;
string clock_24;
time t;
bool Button_pressed;
std::cout <<"clear screen" << std::endl;
while(Button_pressed == true)
{ std::cin >> Button_pressed;
if (Button_pressed= 'N'){
r = r+1;
std::cout << "Clear screen"<< std::endl;
}
else if (Button_pressed ='Y'){
std::cout <<"Menu:" << std::endl;
std::cout <<"User input:" << std::endl;
cin>>user_input;
if (user_input = 'Y'){
exit;
}
else if(user_input ='N'){
std::cout << "Do you want to add an hour?" << std::endl;
cin>> input;
if (input =='Y'){
p = p+1;
break;
}
else if (input =='N'){
std::cout << "Do you want to add a minute?" << std::endl;
std::cin>> input;
if (input =='Y'){
q = q+1;
break;
}
else if (input =='N'){
std::cout << "Do you want to add a second?" << std::endl;
std::cin>> input;
if (input =='Y'){
r = r+1;
break;
}
else
{
break;
}
std::cout << std::string (23, '*')<<" "<< std::string (23, '*')<< std::endl;
std::cout << "* 12-hour Clock *" <<" "<<"* 24-hour Clock *" << std::endl;
std::cout<< "* "<<clock_12<<" *"<<" "<<"* "<<clock_24<<" *"<< std::endl;
std::cout << std::string (23, '*') <<" "<< std::string (23, '*')<< std::endl;
t.get(p,q,r);
t.display();
t.clock_12;
t.clock_24;
return 0;
}