Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ struct time write a program that prompts the user for the hour, minutes, and seconds for a 24-hour time(military time). If the time entered

image text in transcribed

C++ struct time write a program that prompts the user for the hour, minutes, and seconds for a 24-hour time(military time). If the time entered is valid, then one second is added to it, and the new time it output to the screen. struct Time Declare a srtuct named: Time, The struct has 3 data members: hours, minutes, seconds (all interger). In main0 declare an object of Time and name it time - Four function . getTime A void retuning fumction, gets input from user. The object, time, is passed by reference to the function. Note Objects of struct and classes are always passed by refence. The fumction prompts the user to enter the ime. The function reads the time entered by the user. The function returns no value 2. isTimeValid Function returns a bool date type (true or false). The function is called from the getTime finction. The parameter for this function is the time onject that holds the hous, minutes, seconds representing the time entered by the user. This function checks make sure the time entered is valid. HINTif time hours0) && (time hours MAX SECS) { timeseconds = 0: time minutes++, if {"" 4. displayTime: A void returning function displays the time after the second has been added. cout fil(0) The library function wil any empty spaces with the secified character. It checks to see whatt setw is, and the fills if needed. EX: cout

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

More Books

Students also viewed these Databases questions

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

Explain Industrial market segment.

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago