1
0

usetime1.cpp 919 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // usetime1.cpp -- using the second draft of the Time class
  2. // compile usetime1.cpp and mytime1.cpp together
  3. #include <iostream>
  4. #include "mytime1.h"
  5. int main()
  6. {
  7. using std::cout;
  8. using std::endl;
  9. Time planning;
  10. Time coding(2, 40);
  11. Time fixing(5, 55);
  12. Time total;
  13. cout << "planning time = ";
  14. planning.Show();
  15. cout << endl;
  16. cout << "coding time = ";
  17. coding.Show();
  18. cout << endl;
  19. cout << "fixing time = ";
  20. fixing.Show();
  21. cout << endl;
  22. total = coding + fixing;
  23. // operator notation
  24. cout << "coding + fixing = ";
  25. total.Show();
  26. cout << endl;
  27. Time morefixing(3, 28);
  28. cout << "more fixing time = ";
  29. morefixing.Show();
  30. cout << endl;
  31. total = morefixing.operator+(total);
  32. // function notation
  33. cout << "morefixing.operator+(total) = ";
  34. total.Show();
  35. cout << endl;
  36. // std::cin.get();
  37. return 0;
  38. }