-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.h
35 lines (29 loc) · 1.09 KB
/
Time.h
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
#ifndef TIME_H
#define TIME_H
#include <string>
#include <ostream>
using namespace std;
class Time {
public:
// --------------Constructor functions--------------
Time(unsigned int hour = 0, unsigned int minute = 0) : hour_(hour), minute_(minute) {}
Time(const string& hhmm);
// ------------------Get functions------------------
unsigned int get_hour() const;
unsigned int get_minutes() const;
// ------------------Set functions------------------
void set_time(unsigned int hour, unsigned int minute);
void set_time(const string& hhmm);
void set_hour(unsigned int hour);
void set_minute(unsigned int minute);
// -----------------Print function------------------
void print() const;
// -----------------Time functions------------------
bool isBefore(const Time& ctime) const;
// ---------------Operators function----------------
friend ostream& operator << (ostream& os, const Time& tm);
private:
unsigned int hour_;
unsigned int minute_;
};
#endif