这个程序在Microsoft Visual c++里怎么跳出输入循环?
#include<iostream>#include<vector>
using namespace std;
int main()
{
vector<int> ivec;
int m;
cout<<"enter some ints"<<endl;
while(cin>>m)
ivec.push_back(m);
cout<<endl;
for(vector<int>::iterator iter = ivec.begin();iter != ivec.end();++iter)
{
//if((*iter)%2)
// (*iter) *= 2;
*iter = (*iter % 2 == 0 ? *iter : *iter*2);
}
for(vector<int>::iterator iter2 = ivec.begin();iter2 != ivec.end();++iter)
cout<<*iter2<<" ";
cout<<endl;
return 0;
}
就这个程序,我在linux下用ctrl+d就可以跳出输入,可在Microsoft Visual c++里面,输入完数字后,用ctrl+z结束不了输入啊,用特殊判断,比如 (m != 10000000),但成死循环了,请问这是怎么会事?