I cant solve this assignent. I hope a helpfull soul can help me out.
The problems goes like this: Write a program that ask the user to enter the number of seconds as an integer value(use type long) and that then displays the equivalent time in days, hours, minutes and seconds. Use symbolic constants to represent the number of hours in the day, the number of minutes in an hour and the number of seconds in a minute. The output should look like this:
Enter the number of seconds: 31600000
31600000 seconds = 365 days, 46 minutesm 40 seconds
Here is what I have come up with until now, I hope someone really can help me out...
#include <iostream>
using namespace std;
int main(){
int const hourInDay = 24;
int const numOfMinInHour=60;
int const secondsInMin=60;
long second;
cout << "Enter number of seconds: ";
cin >> second;
int days = second / hourInDay / numOfMinInHour / secondsInMin;
cout << days<< "days ";
cin.get();
cin.get();
return 0;
}