-
Notifications
You must be signed in to change notification settings - Fork 0
/
TIME.CPP
59 lines (53 loc) · 883 Bytes
/
TIME.CPP
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
/**
* @file TIME.CPP
* @author Lim Wen Chao
* @brief .cpp for Time.h
* @version 0.1
* @date 2022-02-21
*
*
*/
#include "TIME.H"
Time::Time(unsigned int h, unsigned int m)
{
m_hour = h;
m_minute = m;
}
int Time::GetHour() const
{
return m_hour;
}
int Time::GetMinute() const
{
return m_minute;
}
void Time::SetHour(unsigned int h)
{
m_hour = h;
}
void Time::SetMinute(unsigned int m)
{
m_minute = m;
}
string Time::Display24HTime() const
{
string result;
if(m_hour < 10)
{
result += "0" + to_string(m_hour);
}
else
{
result += to_string(m_hour);
}
result += ":";
if(m_minute < 10)
{
result += "0" + to_string(m_minute);
}
else
{
result += to_string(m_minute);
}
return result;
}