hey guys I was wondering if yall can help me.
the program is to work like this
if there are 60 seconds in a minute it will show the time in number of mintues in that many seconds and 3,600 in an hour the program should display the number of hours in minutes and 86,400 seconds in a day and show the same for days..
so this is what I got but the if statement I don't think is working !!
//Time calculator program
#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
double seconds,//seconds data input by the user
result;//data user should see m either days, minutes, or seconds
//Getting data from the user
cout << "Please enter the number of seconds ? ";
cin >> seconds;
//if user inputs 86400 or higer should display days
if(seconds >= 86400)
{
result = seconds/86400;
cout << fixed << showpoint << setprecision(0);
cout << "The number of days in "<< seconds <<" seconds is "<< result
<<"day/s"<<endl;
}
//If user inputs a number between 3600 and 86400 should display hours
elseif(3600 <= seconds < 86400)
{
result = seconds/3600;
cout << fixed << showpoint << setprecision(0);
cout << "The number of hours in "<< seconds <<" seconds is "<< result
<<"hour/s"<<endl;
}
//If user inputs a number between 60 and 3600 it should display minutes
elseif ( 60 <= seconds < 3600)
{
result = seconds/60;
cout << fixed << showpoint << setprecision(0);
cout << "The number of minutes in "<< seconds <<" seconds is "<< result
<<"minute/s"<<endl;
}
system("pause");
return 0;
}
Thanks I figure that in c++ you can't display (3600 <= seconds < 86400) like in regular math, you should display (3600<=seconds && seconds<86400) hahah I love programming