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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started