what code can you use to make sure that time inputted is in the correct format
cout<<"What is the time of the event?" << endl;
cin.get();
getline(cin, eventTime);
// eventime is a string
example:
user input: 12:36:27 --> valid
user input: 25:60:60 --> invalid
Aucun commentaire:
Enregistrer un commentaire