Kindly help me in function program.

the following attributes and functions of the class Time:
Attributes:
• int hour
• int minute
• int seconds
Functions:
• void setTime(int, int, int);
• void show12Hour();
• void show24Hour();





Write a program to instantiate the object of a class Time from the main() function and constructor is called of the class Time automatically to initialize the private data members of the class with 0. Time is printed on the screen in 12 hours format and 24 hours format as follows:

Initial Time:

Time display in 12 hours format: 12:00:00 AM
Time display in 24 hours format: 00:00

After that use the setTime() function to set the time by passing the 3 attributes of time i.e setTime(13,55,23) and show the time again after setting:

After set:

Time display in 12 hours format: 01:55:23 PM
Time display in 24 hours format: 13:55

Now try to use setTime() function for setting invalid values i.e setTime(25,67,98) . Your program should not set invalid values of time and show finally the time as initial.

Time display in 12 hours format: 12:00:00 AM
Time display in 24 hours format: 00:00

Will you please stop giving us all homework in the hope that we will kindly make all of your programs for you. If you have difficulty with a specific part of a program than ask about it and people will help. But unless there is a very kind person with a lot of spare time, it is very unlikely that anyone on the internet will do all of your work for you. There are many good tutorials and books out there. Read them.
Topic archived. No new replies allowed.