Here's another suggestion that might be easier.
There you go. I often use that method to guard against bad data. Using this method, you needn't even declare another variable. I hope this helps.Code:cout << "prompt for date"; cin >> date; while(/*conditions of bad data*/) { cout << "error message"; cout << "prompt for date"; cin >> date; } cout << "prompt for time"; cin >> time; while(/*conditions of bad data) { cout << "error message"; cout << "prompt for time"; cin >> time; }