// Validating the input of hour do { cout << "Enter the hour (0 - 23)" << endl; cin >> hour; } while( !( hour >= 0 && hour <= 23 ) );