// ========================================================================== // $Id: time_keeper_demoC.cpp,v 1.2 2013/11/05 18:05:16 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_demoC.cpp,v $ // Revision 1.2 2013/11/05 18:05:16 jlang // Updated arguments in main // // 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:08 jlang // time keeper example added // // // ========================================================================== #include #include #ifdef EXPLICIT #include "time_keeper_explicit.h" #else #include "time_keeper.h" #endif using std::cout; using std::endl; TimeKeeper tk1(60); void function1() { #ifdef VERBOSE cout << "function1() starts here" << endl; #endif static TimeKeeper tks(240); TimeKeeper tk(300); #ifdef VERBOSE cout << "end of function1()" << endl; #endif } TimeKeeper function2(TimeKeeper tk) { #ifdef VERBOSE cout << "function2() starts here" << endl; #endif TimeKeeper tkl(360); #ifdef VERBOSE cout << "end of function2()" << endl; #endif return TimeKeeper(tkl + 60); } int main() { #ifdef VERBOSE cout << "main() starts here" << endl; #endif TimeKeeper tk2(120); #ifdef VERBOSE cout << "call to function1()" << endl; #endif function1(); #ifdef VERBOSE cout << "back to main()" << endl; cout << "call to function1()" << endl; #endif function1(); #ifdef VERBOSE cout << "back to main()" << endl; #endif TimeKeeper tk3(180); #ifdef VERBOSE cout << "call to function2()" << endl; #endif tk3= function2(tk2); #ifdef VERBOSE cout << "back to main()" << endl; cout << "end of main()" << endl; #endif return 0; }