So my program is coming along, but now I am writing in the range checking to ensure that the inputs are actually what they should be. My code works fine for time, except for the fact that white space gets ignored. I need to ensure that a user cannot input "10: 09 AM". It must be in the format hh:mm
My code:
void Time::makeAppt()
{
Time startTime, endTime;
cout << "Start time >>";
cin >> startTime;
cout << "End time >> ";
cin >> endTime;
}
istream &operator>>( istream &input, Time &time)
{
input >> time.hour;
input.ignore();
input >> time.minute;
input.ignore();
input >> time.period;
return input;
}
Thank you for any suggestions you might have. =]