Answers for "how to check if the input of user in c++ is interger or not"

C++
2

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;
    }
Posted by: Guest on June-10-2020

Code answers related to "how to check if the input of user in c++ is interger or not"

Browse Popular Code Answers by Language