//global constants
const double SECONDS_MINUTES = 60.00; //no. seconds per minute
const double SECONDS_HOURS = 3600.00; //no. seconds per hour
const double SECONDS_DAYS = 86400.00; //no. seconds per day
int main()
{//begin m.
//variables
double numSeconds = 0;
double numMinutes = 0;
double numHours = 0;
double numDays = 0;
;
//title
cout<<"Time Calculator that Converts Seconds"<<endl;
//directions and prompt
cout<<"Type a number of seconds to see the conversion of the number of days, hours, minutes, and seconds."<<endl;
cout<<"One day has 86400 seconds, an hour has 3600, and a minute has 60 seconds."<<endl;
cout<<"Type seconds, then press enter";
cout<<endl;
cin>>numSeconds; //numMinutes, numHours, numDays; //retrieve and display no. of seconds
In divideSeconds(), for any number big enough, minutes will always be greater than 60. The same will happen with hours and days as the number gets bigger.
Your code seems deliberately written to avoid displaying > 60 mins or > 3600 hrs or > 86400 days.
The assignment is to convert the number of seconds input by user into days, hours, and minutes. The days and hours convert just fine - calculating and displaying but the minutes don't show up at all on the console.
I had the code for minutes exactly the same as hours and days, that didn't work so I changed the 3rd to last line of the 'minutes' block to see if that would make it show up.
the (cout<<....minutes<<I added - minutes here<<endl;
It converts each type separately ( seconds to days) hours, minutes.
It doesn't combine the total into[xxxxxxxxseconds = days?, hours?, and hours?] It is only supposed to calculate and display [xxxxxx seconds = days?];
[seconds = hours?]; and the same for minutes.
So somewhere I am missing something or have added something that's not right, but I don't see it.
This will return the total number of minutes, not the remaining number of minutes after taking into account hours and days. A better way of implementing this would be to use the % (modulus) operator.
Please use code tags in future [ code ] [ /code] (without the spaces). It will make your life easier and our life easier and you will get more help.