I have this function that will take the onput of hours and minutes. And if the delimiter isn't a colon than it should give an error. Same if the hours are larger than 23 and minutes larger than 59. With my current loop, the while bool seems to always be true. What have I done wrong? Can't see anything that i possible could change.
int delaString(string &samtalStart, int &timmarStart, int &minuterStart) {
istringstream is(samtalStart);
char colon;
getline(cin, samtalStart);
is >> timmarStart >> colon >> minuterStart;
while (colon != ':' || timmarStart > 23 || minuterStart > 59) {
cout << "Inkorrekt inmatning, var vänligen skriv in en timme mellan 00-23 och minuter mellan 0-59 i formatet tt:mm.\n" << endl;
getline(cin, samtalStart);
}
// is >> timmarStart >> colon >> minuterStart;
return(timmarStart, minuterStart);
}