Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- #include <cmath>
- int main()
- {
- int time1;
- int time2;
- int time3;
- do
- {
- cin.clear();
- cin >> time1;
- } while (cin.bad() || time1 < 0 || time1> 50);
- do
- {
- cin.clear();
- cin >> time2;
- } while (cin.bad() || time2 < 0 || time2> 50);
- do
- {
- cin.clear();
- cin >> time3;
- } while (cin.bad() || time3 < 0 || time3> 50);
- int totaltimesec = (time1 + time2 + time3);
- double totaltimemin = abs(totaltimesec / 60);
- double totaltimesec1 = abs(totaltimesec - totaltimemin * 60);
- if (totaltimesec1 < 10)
- {
- cout << totaltimemin << ":0" << totaltimesec1 << endl;
- }
- else
- {
- cout << totaltimemin << ":" << totaltimesec1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement