cpp check if the user entered string where ecsepted integer code example
Example: how to ensure the user inouts a int and not anything else c++
int x;
std::cin >> x;
while(std::cin.fail()) {
std::cout << "Error" << std::endl;
std::cin.clear();
std::cin.ignore(256,'\n');
std::cin >> x;
}