home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / tutorial / cpptutor / source / clock.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-15  |  483 b   |  29 lines

  1. #include <iostream.h>
  2. #include "clock.h"
  3.  
  4.  
  5.  
  6. clock::clock(void)
  7. {
  8.    hour = 8;
  9.    minute = 51;
  10. }
  11.  
  12.  
  13.  
  14.  
  15. void clock::inc_and_print_time(void)
  16. {
  17.    minute++;            // Add one minute to the time
  18.    if (minute > 59) {
  19.       minute -= 60;
  20.       hour++;
  21.    }
  22.  
  23.                         // Output the user prompt
  24.    cout << "\n      It is now " << hour << ":"; 
  25.    if (minute < 10)
  26.       cout << "0";
  27.    cout << minute << "am, what do you wish to do?     ";   
  28. }
  29.