Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include "pch.h"
  2. #include "Header.h"
  3.  
  4. timestamp::timestamp(byte Hours, byte Minutes, byte Seconds)
  5. {
  6.     h = Hours;
  7.     m = Minutes;
  8.     s = Seconds;
  9. }
  10.  
  11. void timestamp::print()
  12. {
  13. }
  14.  
  15. timestamp & timestamp::Add_Hours(byte h1)
  16. {
  17.     h = h + h1;
  18.     h = h % 24;
  19.     return *this;
  20.     // TODO: вставьте здесь оператор return
  21. }
  22.  
  23. timestamp & timestamp::Add_Minutes(byte m1)
  24. {
  25.     m = m + m1;
  26.     h = h + m / 60;
  27.     m = m % 60;
  28.     h = h % 24;
  29.     return *this;
  30.     // TODO: вставьте здесь оператор return
  31. }
  32.  
  33. timestamp & timestamp::Add_Seconds(byte s1)
  34. {
  35.     s += s1;
  36.     m = m + s / 60;
  37.     s = s % 60;
  38.     h = h + m / 60;
  39.     m = m % 60;
  40.     h = h % 24;
  41.     return *this;
  42.     // TODO: вставьте здесь оператор return
  43. }
  44.  
  45. ostream & operator<<(ostream & o, timestamp ts)
  46. {
  47.     o << ts.h << "." << ts.m << "." << ts.s;
  48.     return o;
  49.     // TODO: вставьте здесь оператор return
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement