More on Input You can test std::cin to see if input succeeded #include int main() { int x, y; if (std::cin >> x >> y) std::cout << "worked" << std::endl; else std::cout << "failed" << std::endl; }