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 
18 class DateTime
19 {
20 
21  friend ostream& operator<<( ostream& out, const DateTime& dt );
22  friend istream& operator>>( istream& in, DateTime& dt ) throw ( invalid_argument );
23 
24  public:
25  DateTime();
26  DateTime( int mm, int dd, int yy, int h, int m, string period ) throw ( invalid_argument );
27  bool operator==( const DateTime& dt ) const;
28  bool operator!=( const DateTime& dt ) const;
29  bool operator<( const DateTime& dt ) const;
30  bool operator>( const DateTime& dt ) const;
31  void print( ostream& out = cout ) const;
32  void setDate( int mm, int dd, int yy ) throw ( invalid_argument );
33  void setTime( int h, int m, string period ) throw ( invalid_argument );
34 
35  private:
37  int mm;
39  int dd;
41  int yy;
43  int h;
45  int m;
47  string period;
48 
49 }; // DateTime
50 
51 #endif
Definition: datetime.h:18
ostream & operator<<(ostream &out, const DateTime &dt)
Definition: datetime.cc:161
int h
Definition: datetime.h:43
istream & operator>>(istream &in, DateTime &dt)
Definition: datetime.cc:188
int m
Definition: datetime.h:45
int dd
Definition: datetime.h:39
string period
Definition: datetime.h:47
int mm
Definition: datetime.h:37
int yy
Definition: datetime.h:41