Question: Write C++structdefinition ,time, that can be used to store a time of day in terms of three values: Hours (an integer value in the range

WriteC++structdefinition,time, that can be used to store a time of day in terms of three values:

  • Hours (an integer value in the range 0 to 23)
  • Minutes (an integer value in the range 0 to 59)
  • Seconds (an integer value in the range 0 to 59)

Then, write C++ function,gettime, that will prompt for and read a time, entered in the formathhmmss(for example, 123456 represents the time 12 hours, 34 minutes, and 56 seconds). The function will then convert the input time into separate hours, minutes, and seconds values, store these into atimevariable, and then return thistimevalue.

Requirements:

  • Functiongetttimeshould not have any parameters.
  • You may assume the user will enter a number in the correcthhmmssformat.
  • You only need to write thestructtimedefinition and the functiongettimeprototype and function definition.You do not need to write complete program.

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 Programming Questions!