Use std::cin.ignore() to keep the user typing until the input meets the requirements
2023-03-25
ccppinput-validationstd-cinI used to control users' input by making the input a string and process it later. But today, my friend posed this question to me: Can we control input without a char array or string class?