создание автоматического тайм-аута с помощью оператора std :: cin
Я написал программу
#include
using namespace std;
int n;
int main(int argc, char *argv[])
{
std::cout < "Before reading from cin" < std::endl;
// Below reading from cin should be executed within stipulated time
bool b=std::cin >> n;
if (b)
std::cout < "input is integer for n and it's correct" < std::endl;
else
std::cout < "Either n is not integer or no input for n" < std::endl;
return 0;
}