Advertisement
Josif_tepe

Untitled

Jan 29th, 2024
1,078
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int tm1, ts1;
  7.     int tm2, ts2;
  8.     int dm1, ds1;
  9.     int dm2, ds2;
  10.    
  11.     cin >> tm1 >> ts1;
  12.     cin >> tm2 >> ts2;
  13.     cin >> dm1 >> ds1;
  14.     cin >> dm2 >> ds2;
  15.    
  16.     int tufi = (tm1 * 60) + ts1 + (tm2 * 60) + ts2;
  17.     int dvojce = (dm1 * 60) + ds1 + (dm2 * 60) + ds2;
  18.    
  19.     int razlika;
  20.     if(tufi < dvojce) {
  21.         cout << "T" << endl;
  22.         razlika = dvojce - tufi;
  23.     }
  24.     else {
  25.         cout << "D" << endl;
  26.         razlika = tufi - dvojce;
  27.     }
  28.     int minuti = razlika / 60;
  29.     int sekundi = razlika % 60;
  30.     cout << minuti << endl;
  31.     cout << sekundi << endl;
  32.     return 0;
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement