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.
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
|
#include <iostream>
#include <iomanip>
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.