#include <iostream>
#include <cctype>
#ifndef TIME
#define TIME
/*********************************************************************
The time class stores times as hours, minutes, and seconds.
It is accurate to one second and has a maximum
storage of MAX_INT hours.
John Dolan Updated:April 2003
***********************************************************************/
class Time{
public:
Time();
Time(int init_seconds);
Time(int hrs,int min,int sec);
void set_time(int sec);
void set_time(int hrs,int min,int sec);
// I/O OPERATORS
friend std::istream& operator >>(std::istream& ins,Time& t);
friend std::ostream& operator <<(std::ostream& outs, Time& t);
// ARITHEMETIC OPERATORS
friend Time operator +(const Time& t1, const Time& t2);
friend Time operator -(const Time& t1, const Time& t2);
friend Time operator /(const Time& t1, const int& num);
// COMPARISON OPERATORS
friend bool operator ==(const Time& t1, const Time& t2);
friend bool operator !=(const Time& t1, const Time& t2);
friend bool operator >=(const Time& t1, const Time& t2);
friend bool operator <=(const Time& t1, const Time& t2);
friend bool operator >(const Time& t1, const Time& t2);
friend bool operator <(const Time& t1, const Time& t2);
private:
long all() const; // returns the time as an integer number of
// seconds
void back_to(long all_num); // resets time from a long int
int hours;
int minutes;
int seconds;
};
#endif