Time Calculator
Dec 13, 2013 at 12:55am UTC
i keep getting errors when i compile my program but i dont know how to fix it..
can somebody help me please?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
int sec_perMinute = 60,
sec_perHour = 3600,
sec_perDay = 86400,
seconds;
if ( cin >> seconds && seconds > 0 )
{
const int days = seconds/sec_perDay;
if ( seconds >= sec_perDay)
{
seconds =+%sec_perDay;
cout << "days : " << days << endl;
cout << "seconds : " << seconds;
}
else if ( seconds >= sec_perHour)
{
const int hours = seconds/sec_perHour;
seconds =+%sec_perHour;
cout << "hours : " << hours << endl;
cout << "seconds :" << seconds << endl;
}
else if ( seconds >= sec_perMinute)
{
const int minutes = seconds/sec_perMinute;
seconds =+%sec_perMinute;
cout << "minutes :" << minutes << endl;
cout << "seconds :" << seconds << endl;
}
else
{
cout << "that is not a valid number" << endl;
}
}
Dec 13, 2013 at 12:57am UTC
And the errors are...??
Dec 13, 2013 at 12:59am UTC
main.cpp:46: error: expected primary-expression before '%' token..
Dec 13, 2013 at 1:00am UTC
Lines 11, 19, and 26 are not syntactically valid. What are you trying to do?
Dec 13, 2013 at 1:08am UTC
lets say a user inputs 90,000. the program will calculate and display the number of days using the number of seconds and then display the remaining seconds.
Topic archived. No new replies allowed.