// ========================================================================== // $Id: time_keeper_demoB.cpp,v 1.3 2013/11/05 18:05:15 jlang Exp $ // CSI2372 example Code for lecture 12 // ========================================================================== // (C)opyright: // // Robert Laganier // SITE, University of Ottawa // 800 King Edward Ave. // Ottawa, On., K1N 6N5 // Canada. // http://www.site.uottawa.ca // // Creator: jlang (Jochen Lang) // Email: jlang@site.uottawa.ca // ========================================================================== // $Log: time_keeper_demoB.cpp,v $ // Revision 1.3 2013/11/05 18:05:15 jlang // Updated arguments in main // // Revision 1.2 2010/11/24 16:16:17 jlang // Added static cast for use of += operator // // Revision 1.1 2008/11/14 22:13:43 jlang // Moved timekeeper example in own directory; added makefile // // Revision 1.1 2006/11/12 18:18:07 jlang // time keeper example added // // // ========================================================================== #include #ifdef EXPLICIT #include "time_keeper_explicit.h" #else #include "time_keeper.h" #endif using std::cout; using std::endl; int main() { TimeKeeper t1(2,1,45,30), t2(516473), t3; // Print non-zero time durations cout << "a) " << t1 << endl; cout << "b) " << t2 << endl; // Add first and second and assign to third t3= t1 + t2; cout << "c) " << t3 << endl; // Subtract integer from time t3= t2 - 25; cout << "d) " << t3 << endl; // Add integer to time t3+= static_cast(25); // t3+= 25; cout << "e) " << t3 << endl; // Subtract first from second and assign to int #ifdef EXPLICIT int t; t= t2 - t1; cout << "f) " << t << endl; #endif return 0; }