MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / DayTime

Class DayTime

Lab_13/main1.cpp:6–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace std;
5
6class DayTime
7{
8private:
9 int hour, minute, second;
10
11public:
12 DayTime()
13 {
14 hour = 0;
15 minute = 0;
16 second = 0;
17 }
18
19 DayTime(int h, int m, int s)
20 {
21 hour = h;
22 minute = m;
23 second = s;
24 }
25 int getHour() const
26 {
27 return hour;
28 }
29 int getMinute() const
30 {
31 return minute;
32 }
33 int getSecond() const
34 {
35 return second;
36 }
37
38 void DisplayTime()
39 {
40 cout << "HH: " << hour << endl
41 << "MM: " << minute << endl
42 << "SS: " << second << endl;
43 }
44 int asSeconds() const
45 {
46 return (3600 * hour + 60 * minute + second);
47 }
48
49 friend void operator<<(ostream &out, DayTime &h);
50 friend void operator>>(istream &in, DayTime &h);
51 friend void operator++(DayTime &MainDayTime);
52 friend void operator--(DayTime &MainDayTime2);
53};
54
55void operator>>(istream &in, DayTime &h)
56{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected