Source of test_time.cpp


  1: /** @file test_time.cpp
  2: Test driver for the Time class.
  3: */

  5: #include <iostream>
  6: using namespace std;

  8: #include "time.h"

 10: int main()
 11: {
 12:     Time t1;
 13:     Time t2(5);
 14:     Time t3(5, 30);
 15:     Time t4(5, 30, 10);

 17:     cout << "\nt1: ";  t1.display();
 18:     cout << "\nt2: ";  t2.display();
 19:     cout << "\nt3: ";  t3.display();
 20:     cout << "\nt4: ";  t4.display();
 21:     cout << "\nPress Enter to continue ... ";  cin.ignore(80, '\n');

 23:     Time t;
 24:     t.set(23, 59, 55);
 25:     cout << "\nt: ";  t.display();
 26:     cout << "\nPress Enter to continue ... ";  cin.ignore(80, '\n');

 28:     cout << "\nIncrementing t:" << endl;
 29:     for (int count = 1; count <= 10; count++)
 30:     {
 31:         t.display();
 32:         cout << ' ';
 33:         t.increment();
 34:         cout << endl;
 35:     }
 36:     cout << "Press Enter to continue ... ";  cin.ignore(80, '\n');
 37: }