Advertisement
wigllytest

Untitled

Aug 4th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int hourExam, minExam, hourArr, minArr;
  8. cin >> hourExam >> minExam >> hourArr >> minArr;
  9.  
  10. int minutesExam = hourExam * 60 + minExam;
  11. int minutesArrival = hourArr * 60 + minArr;
  12.  
  13. int deltaMinutes = minutesExam - minutesArrival;
  14. int hour = abs(deltaMinutes / 60);
  15. int minutes = abs(deltaMinutes % 60);
  16.  
  17. if (deltaMinutes < 0)
  18. {
  19. if (deltaMinutes > - 60)
  20. {
  21. cout << "Late" << endl;
  22. cout << minutes << " minutes after the start";
  23. }
  24. else if (deltaMinutes <= -60 && minutes >=10)
  25. {
  26. cout << "Late" << endl;
  27. cout << hour << ":" << minutes << " hours after the start";
  28. }
  29. else if (deltaMinutes <= -60 && minutes < 10)
  30. {
  31. cout << "Late" << endl;
  32. cout << hour << ":0" << minutes << " hours after the start";
  33. }
  34. }
  35. else if (deltaMinutes == 0)
  36. {
  37. cout << "On time";
  38. }
  39. else if (deltaMinutes > 0)
  40. {
  41. if (deltaMinutes <=30)
  42. {
  43. cout << "On time" << endl;
  44. cout << minutes << " minutes before the start";
  45. }
  46. else if (deltaMinutes > 30 && deltaMinutes < 60)
  47. {
  48. cout << "Early" << endl;
  49. cout << minutes << " minutes before the start";
  50. }
  51. else if (deltaMinutes >= 60 && minutes >=10)
  52. {
  53. cout << "Early" << endl;
  54. cout << hour << ":" << minutes << " hours before the start";
  55. }
  56. else if (deltaMinutes >= 60 && minutes < 10)
  57. {
  58. cout << "Early" << endl;
  59. cout << hour << ":0" << minutes << " hours before the start";
  60. }
  61. }
  62.  
  63.  
  64.  
  65.  
  66. return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement