int inputHour() { // Variable declarations int hour; // Read the hour cout << "Please enter the hour (0-23)" << endl; cin >> hour; // If it is a valid value, return if( hour >= 0 && hour <= 23 ) return hour; else return inputHour(); }