Answered step by step
Verified Expert Solution
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
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
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