Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Laikas {
  6. private:
  7. int h, min, s, sekundes;
  8. public:
  9. Laikas():h(0),min(0),s(0){}
  10. Laikas(int x,int y,int z):h(x),min(y),s(z){}
  11. ~Laikas(){}
  12. void Ivedimas() {
  13.  
  14. cin >> h >> min >> s;
  15.  
  16. }
  17. void Skaiciavimas() {
  18.  
  19. sekundes = (((h*60)+min)*60+s)/3;
  20. min = sekundes/60;
  21. s = sekundes%60;
  22. h = min/60;
  23. min = min%60;
  24.  
  25. }
  26. int graz_h() {
  27.  
  28. return h;
  29.  
  30. }
  31. int graz_min() {
  32.  
  33. return min;
  34.  
  35. }
  36. int graz_s() {
  37.  
  38. return s;
  39.  
  40. }
  41. };
  42.  
  43. int main() {
  44.  
  45. int n;
  46. int h, min, s;
  47.  
  48. cin >> n;
  49. Laikas L;
  50. L.Ivedimas();
  51.  
  52. for (int i = 0; i < n; i++)
  53. {
  54. L.Skaiciavimas();
  55. min = L.graz_min();
  56. s = L.graz_s();
  57. //
  58. if(min<=9 && s<=9)
  59. {
  60. cout<<"0"<< L.graz_h() << ":"<<"0"<< L.graz_min() << ":"<<"0"<< L.graz_s() << endl;
  61. }
  62. //
  63. if(min<=9 && s>=10)
  64. {
  65. cout<<"0"<< L.graz_h() << ":"<<"0"<< L.graz_min() << ":"<< L.graz_s() << endl;
  66. }
  67. //
  68. if(min>=10 && s>=10)
  69. {
  70. cout<<"0"<< L.graz_h() << ":"<< L.graz_min() << ":"<< L.graz_s() << endl;
  71. }
  72. //
  73. if(min>=10 && s<=9)
  74. {
  75. cout<<"0"<< L.graz_h() << ":"<< L.graz_min() << ":"<<"0"<< L.graz_s() << endl;
  76. }
  77.  
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement