-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.h
35 lines (34 loc) · 873 Bytes
/
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
#pragma once
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class Time{
int hour; int minute;
public:
Time(){hour=minute=0;}
Time(int hour, int minute);
void setHour(int hour);
void setMinute(int minute);
int getHour();
int getMinute();
//to add minutes into current time
Time operator-(Time t);
Time operator+(int minute);
void operator+=(int minute);
Time operator++();
//display on console, file
friend ostream& operator<<(ostream&,Time);
friend ofstream& operator<<(ofstream&, Time);
//compare time
bool operator!=(Time t);
bool operator==(Time t);
bool operator<(Time t);
bool operator>(Time t);
bool operator<=(Time t);
bool operator>=(Time t);
//assignment operator
Time operator=(int a){
hour=minute=0; return *this;
}
};