scopolamine

Time.h

Mar 31st, 2011
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. // Fig. 9.8: Time.h
  2. // Time class containing a constructor with default arguments.
  3. // Member functions defined in Time.cpp.
  4.  
  5. // prevent multiple inclusions of header file
  6. #ifndef TIME_H
  7. #define TIME_H
  8.  
  9. // Time abstract data type definition
  10. class Time
  11. {
  12. public:
  13.    Time( int = 0, int = 0, int = 0 ); // default constructor
  14.  
  15.    // set functions
  16.    void setTime( int, int, int ); // set hour, minute, second
  17.    void setHour( int ); // set hour (after validation)
  18.    void setMinute( int ); // set minute (after validation)
  19.    void setSecond( int ); // set second (after validation)
  20.  
  21.    // get functions
  22.    int getHour(); // return hour
  23.    int getMinute(); // return minute
  24.    int getSecond(); // return second
  25.  
  26.    void printUniversal(); // output time in universal-time format
  27.    void printStandard(); // output time in standard-time format
  28.    void tickTime( int ); // time counter
  29.    void wait( int ); // waiting time
  30. private:
  31.    int hour; // 0 - 23 (24-hour clock format)
  32.    int minute; // 0 - 59
  33.    int second; // 0 - 59
  34. }; // end class Time
  35.  
  36. #endif
Advertisement
Add Comment
Please, Sign In to add comment