这里是我的代码。使用报警(3)退出程序 - C++
#include<iostream>
int main()
{
std::string str;
while(true)
{
std::cout<<"enter string \n";
alarm(3);
getline(std::cin,str);
// calling another function in some other class,
and return to here (If not entered any string in 3 sec)
}
return 0;
}
2秒后它退出我的程序。但是,我想继续调用另一个函数并返回到同一个getline()。可能吗?? 感谢
这在您的其他问题中不止一次得到解答。 – chris 2013-03-21 07:03:00
不一样-chris 观察一次,现在我想继续在同一个程序中。 反正只是在这里放下你的想法 谢谢 – 2013-03-21 08:12:21