Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <cmath>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. class time
  10. {
  11. private:
  12.  
  13. long long Hou, Min, Sec;
  14. long long Allsec;
  15.  
  16. public:
  17.  
  18. time( ){ Hou = 0, Min = 0, Sec = 0, Allsec = 0; }
  19.  
  20. void getData()
  21. {
  22. cin >> Hou >> Min >> Sec;
  23. }
  24.  
  25. int getAllsec()
  26. {
  27. Allsec = Hou*3600+Min*60+Sec;
  28. return Allsec;
  29. }
  30.  
  31. ~time(){};
  32.  
  33. };
  34.  
  35. int main()
  36. {
  37. time t;
  38.  
  39. int H, M, S, temp;
  40. int NumN;
  41. cin >> NumN;
  42.  
  43. t.getData();
  44.  
  45. temp = t.getAllsec();
  46.  
  47. for( int i=0; i<NumN; i++ )
  48. {
  49.  
  50. temp = temp / 3;
  51.  
  52. H = temp/3600;
  53. M = (temp%3600)/60;
  54. S = (temp%3600)%60;
  55.  
  56. cout << setfill('0') << setw(2) << H << ":";
  57. cout << setfill('0') << setw(2) << M << ":";
  58. cout << setfill('0') << setw(2) << S << endl;
  59. }
  60.  
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement