Hello... my book that i'm reading wants me to create a program that will declare a structure called Time that contains members to store the hours, minutes, and seconds. I will have to Prompt the user for the input time and then call the GetTime function which will have the job that extracts the integer values and assigns them to the members of a Time Structure. (I KNOW HOW TO DO THIS) but... if GetTime returns a value of false , that means that it wasn't able to get all three integer values. otherwise it should return true... first question is i don't know what to check for for a false to return...
question two: I also have another function called IsTimeVaild which will validate if the user enters a correct time or not . so for example if user enters in "Please enter the time in HH:MM:SS format: 12 24 33" will show invaild display the time required is HH:MM:SS but i don't know how to test to make sure the user enters in the colons.. little lost here.. the GetTime function won't simply wait for the user to enter three separate integer values; instead the input must be in HH:MM:SS format (that's the hours followed by a single colon followed by the minutes followed by another colon followed by the seconds).
question three: AddOneSecond function this function will add one second to the time. so for example if any of the Time structure fields need to rollover (the hours, minutes or seconds need to be reset to zero) this function will handle that.. .
DisplayTime-----> u will see that my last function should just display the time.
**below is what i have so far.. my strugle is the functions i need to built that's what i'm needing help... this book does not contain the source code so i can't even check what i have any help would be great thanks .
using namespace std;
// structure declaration
//TODO: create the "Time" structure with members for hours, mins and seconds.
// defined constants
const int MAX_HOURS = 23;
const int MAX_MINS = 59;
const int MAX_SECS = 59;
// function prototypes
void AddOneSecond(Time &timeParam);
bool GetTime(Time &timeParam);
void DisplayTime(const Time &timeParam);
bool IsTimeValid(const Time &timeParam);
// ==== main ==================================================================
cout << "Please enter the time in HH:MM:SS format: ";
if ((false == GetTime(userTime)) || (false == IsTimeValid(userTime)))
cout << "Invalid input..." << endl;
//display the incremented time
cout << "The incremented time is ";
} // end of main