新手求助~~多个vector对象的建立
我要读入两个int型vector对象ivec1和ivec2程序如下:
#include<iostream>
#include<vector>
using namespace std;
int main()
{
//读入两个int型的vector对象
int input1, input2;
vector<int> ivec1, ivec2;
cout << "Enter an int-type vector object:" << endl
<<"ivec1 = "<< endl;
while (cin >> input1)
ivec1.push_back (input1);
cout << endl;
cout << "Enter another int-type vector object:" << endl
<<"ivec2 = "<< endl;
while (cin >> input2)
ivec2.push_back (input2);
cout << endl;
reutrn 0;
}
可是怎么不对呢,只能读入ivec1,不能读入ivec2,直接就跳过去了。