Question: the ctime header file contains a special function called time(0) which returns the number of seconds since 1/1/1970 when the function is called. you will

the ctime header file contains a special function called time(0) which returns the number of seconds since 1/1/1970 when the function is called.

you will test this function as following:

create a class called TimeC, this class contains:

- a private integer call it creation

- default constructor, assign time(0) to creation

- a method that will return creation value, call it getCreationTime() (the method should return an integer)

- a method to calculate the age (call it age and it returns an integer). in this method, a new value for time(0) will be calculated. the previous creation value should be subtracted from it. [time(0)-creation]

test your class as following:

- creating an TimeC object

- print the creation value by calling the method getCreationTime()

- print a waiting message on the screen to hold the execution for few seconds.

* use system("pause"); or cin.get(x);

[for cin.get(x) you will need to create a char variable called x]

- print the age value by calling the function age();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!