c++ std::cin被困在80行输入中
C++ std::cin is stuck at 80 lines of input
这是我的代码
int main()
{
int total = 0;
int count = 0;
std::cin >> total;
int arr[4] = {0,0,0,0};
while(count < total)
{
std::cin>>arr[0]>>arr[1]>>arr[2]>>arr[3];
count++;
std::cout<<count<<std::endl;
}
return 0;
}
所以输入的第一行告诉我在…之后需要读多少行,每行有4个用空格分隔的数字。每当行数超过80(e。g100),然后while循环卡住。我不知道是什么原因导致的问题,我已经尝试了一些事情,如cin.clear(),但他们只是不工作....
Edit: std::cin在格式为10 20 210 10的80行输入后停止读取
Xcode with LLVM不工作…然而,g++使用终端工作....http://melpon.org/wandbox/permlink/UXAMgM4ldn2K2NgU下面的代码可以在我的终端上使用g++,但不能在我的xcode中使用…
是输出卡住了。除非count
的输出正在被某些东西读取并消耗,否则最终输出缓冲区将满,cout
行将阻塞。
相关文章:
- Arduino Nano:A4988 使用串行输入时通过定时器进行步进控制不稳定
- 使用makefile中的命令行输入
- Qt读取串行输入,然后将其拆分为单独的变量
- 为什么在输入的第一行输入测试用例数量后得到垃圾值?
- 如何停止带有串行输入的循环
- C++使用命令行输入 txt 文件,但打开文件失败
- C 错误:从命令行输入更改为变量输入
- 为什么输入流从第二行输入中删除一些字符
- 为什么这个C++程序适用于第一行输入,而不适用于第二行或第三行
- 如何创建一个 void 数组,其大小将由用户从命令行输入指定
- 如何对每行输入应用不同的函数
- 从命令行输入分配二维数组
- C++交叉编译不处理换行输入文本文件
- istream用于C++/Poco的命令行输入
- cout在获取行输入(getline)后无法在c++中工作
- 命令行输入c++
- C++读取串行输入到字符串
- 从命令行输入
- c++ std::cin被困在80行输入中
- 为什么我的cin在有80多行输入时会出错