Problem 12 Help pleas i cant corecct calculate hourse

Back to General discussions forum

localevil3     2017-02-10 09:51:07

include <iostream>

using namespace std;

int day1, day2, houre1, houre2, min1, min2, sec1, sec2, n, result, res[4]; long onSec1, onSec2, mod; int main() { cin >> n; for(int i =0; i < n; i++) { cout << '('; cin >> day1 >> houre1 >> min1 >> sec1 >> day2 >> houre2 >> min2 >> sec2; min1 =60; min2=60; houre1=6060; houre2=6060; day1=606060; day2=606060; onSec1=sec1+min1+houre1+day1; onSec2=sec2+min2+houre2+day2; result = onSec2-onSec1; for (int j =0; j < 4; j++) { mod=result % 60; result /= 60; res[j]=mod; } for (int j=3; j>=0; j--) { cout << res[j]; if (j!=0) cout << ' '; } cout << ')' << ' '; }

}

tonychamberlain     2017-02-10 12:47:49

shouldnt it be

min1*=60;
hour1*=(60*60);
day1*=(24*60*60);

if you indent in 4 spaces it shows up as code

Please login and solve 5 problems to be able to post at forum