New course! Every coder should learn Generative AI!
Try a free lesson0
How do I force my program to only accept numbers in turbo C++ ???
1 Answer
+ 1
int input;
if (!(std::cin >> input))
std::cerr << "Your input could not be validated, did you provide something else than a number?\n";