Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int r(double d) {
  6. double r = d - int(d);
  7. if (r < 0.5) {
  8. return int(d);
  9. } else {
  10. return int(d) + 1;
  11. }
  12. }
  13.  
  14. int main() {
  15. double a, b, c;
  16. cin >> a >> b >> c;
  17. double s = 0;
  18. s = r(c / 6);
  19. if (s == 60) {
  20. s = 0;
  21. }
  22. double m = r((b - (s / 10)) / 6);
  23. if (m == 60) {
  24. m = 0;
  25. }
  26. double h = r((a - (s / 600) - (m / 10)) / 30);
  27. if (h == 60) {
  28. h = 0;
  29. }
  30. if (h < 10)
  31. cout << "0";
  32. cout << h << ":";
  33. if (m < 10)
  34. cout << "0";
  35. cout << m << ":";
  36. if (s < 10)
  37. cout << "0";
  38. cout << s << "\n";
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement