### time

Here's the problem I need help on.

Write a program that asks the user to enter a number of seconds.

There are 60 seconds in a minute. If the number of seconds entered by the user is
greater than or equal to 60, the program should display the number of minutes in
that many seconds.
There are 3,600 seconds in an hour. If the number of seconds entered by the user
is greater than or equal to 3,600, the program should display the number of hours
in that many seconds.
There are 86,400 seconds in a day. If the number of seconds entered by the user is
greater than or equal to 86,400, the program should display the number of days
in that many seconds.

 ``1234567891011121314151617181920212223242526272829`` ``````#include #include using namespace std; int main() { double seconds; double minutes = 60.0; double hours = 3600; double days = 86400; cout << "Enter a number of seconds: " << endl; cin >> seconds; cout << fixed << showpoint << setprecision(1); if (minutes >=60) { cout << "There are minutes in seconds." << setw(1) << minutes << endl;} cout << fixed << showpoint << setprecision(1); if (hours >=3600) { cout << "There are hours in seconds." << setw(1) << hours << endl;} cout << fixed << showpoint << setprecision(1); if (days >=86400) { cout << "There are days in seconds." << setw(1) << days << endl;} cout << endl; return 0; }``````

also i was wondering how do i include these in the code?
There are 1666.667 minutes in 100000.000 seconds.
There are 27.778 hours in 100000.000 seconds.
There are 1.157 days in 100000.000 seconds.
I suggest you look into <ctime>. They're functions in that library that will be able to help time your program.

http://www.cplusplus.com/reference/clibrary/ctime/
You will need to put the conversions into your program as well.
any example? ty
 ``123456`` ``````//as long as there are more than 60 seconds while (seconds > 60) { seconds -= 60; // subtracts 60 seconds from the number of seconds ++minutes; // adds 1 to the number of minutes }``````
Topic archived. No new replies allowed.