Project 1
datetime.h
Go to the documentation of this file.
1 #ifndef DATETIME_H
2 #define DATETIME_H
3 
4 #include <iostream>
5 #include <string>
6 #include <stdexcept>
7 
8 using namespace std;
9 
19 class DateTime
20 {
21 
22  friend ostream& operator<<( ostream& out, const DateTime& dt );
23  friend istream& operator>>( istream& in, DateTime& dt );
24 
25  public:
26  DateTime();
27  DateTime( int mm, int dd, int yy, int h, int m, string period );
28  bool operator==( const DateTime& dt ) const;
29  bool operator!=( const DateTime& dt ) const;
30  bool operator<( const DateTime& dt ) const;
31  bool operator>( const DateTime& dt ) const;
32  void setDate( int mm, int dd, int yy );
33  void setTime( int h, int m, string period );
34 
35  private:
37  int mm;
39  int dd;
41  int yy;
43  int h;
45  int m;
47  string period;
48 
49  unsigned long toLong() const;
50 
51 }; // DateTime
52 
53 #endif
Definition: datetime.h:20
int h
Definition: datetime.h:43
int dd
Definition: datetime.h:39
string period
Definition: datetime.h:47
int m
Definition: datetime.h:45
int yy
Definition: datetime.h:41
int mm
Definition: datetime.h:37
istream & operator>>(istream &in, DateTime &dt)
Definition: datetime.cc:235
ostream & operator<<(ostream &out, const DateTime &dt)
Definition: datetime.cc:207