Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You can find out how many seconds have elapsed since Jan 1, 1970 using the time() function. #include now = time(NULL); // now is more

You can find out how many seconds have elapsed since Jan 1, 1970 using the time() function.

#include now = time(NULL); // now is more than a billion seconds (which data type should you use?)

Write a program that estimates how many years, months, weeks, days, and hours have gone by since Jan 1 1970 by calculations with the number of seconds that have passed. The number of months must be less than 12, i.e., take out how many years have gone by first, then how many months are left, then weeks, etc.

Assume that all years have 365 days, and all months have 30.42 days.

The output should be a count down on the "current day" by displaying how many years, then months, then weeks, then days, and then hours have gone by since Jan. 1 1970.

So example output should read something like:

Since Jan. 1 1970

It's been 47 years, 5 months, 2 weeks, 6 days, and 11 hours

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions