Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int poceten_cas, pocetna_minuta;
- cin >> poceten_cas >> pocetna_minuta;
- int kraen_cas, krajna_minuta;
- cin >> kraen_cas >> krajna_minuta;
- int mp = (poceten_cas * 60) + pocetna_minuta;
- int mk = (kraen_cas * 60) + krajna_minuta;
- if (poceten_cas > kraen_cas)
- {
- mk += 1440;
- }
- else if (poceten_cas == kraen_cas and pocetna_minuta > krajna_minuta)
- {
- mk += 1440;
- }
- int vremetraenje = mk - mp;
- int ac = vremetraenje / 60;
- int am = vremetraenje % 60;
- if (ac < 10)
- {
- cout << "0";
- }
- cout << ac << ":";
- if (am < 10)
- {
- cout << "0";
- }
- cout << am << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement