I am converting seconds to minutes, hours, days. For some reason I have an issue with the days not calculating when running the program. The 'if' statement seems completely ignored by the program. I think this may be caused by the warning I get. Any help would be greatly appreciated in explaining the warning and my current issue:
Warning: Constant is long in function main()
#include <iostream.h>
//using namespace std;
int main()
{
// Constants for Conversion
int seconds, minute, hour;
double day;
cout << "Enter the number of seconds: ";
cin >> seconds;
day = seconds / 86400;
seconds = seconds % 86400;
hour = seconds / 3600;
hour = hour % 3600;
minute = seconds / 60;
minute = minute % 60;
seconds = seconds % 60;
if (day > 0)
{
cout << "Number of days: " << day << endl;
}
if (hour > 0)
{
cout << "Number of hours: " << hour << endl;
}
if (minute > 0)
{
cout << "Number of minutes: " << minute << endl;
}
if (seconds > 0)
{
cout << "Number of seconds: " << seconds << endl;
}
return 0;
}