I am sure that I am making some obvious mistake. I googled my question but I could not find a similar question; apologies if it is there somewhere.
Basically, I just want to complete entries for a series of vectors. The programme compiles, and I can complete the first vector; however, it skips over the second and third vector and the programme ends. I can get it to work if I enter cout << "Something" << endl;
between each vector. The code is as follows:
int main()
{
vector<string> name;
string temp_name;
for (unsigned int counter1 = 0; counter1 < 10; ++counter1)
{
getline(cin, temp_name);
name.push_back(temp_name);
}
vector<int> int1;
int temp_int1 = 0;
for (unsigned int counter2 = 0; counter2 < 10; ++counter2)
{
cin >> temp_int1;
int1.push_back(temp_int1);
}
vector<int> int2;
int temp_int2 = 0;
for (unsigned int counter3 = 0; counter3 < 10; ++counter3)
{
cin >> temp_int2;
int2.push_back(temp_int2);
}
return 0;
}
I was just playing around with code and came across this... I am sure its something obvious, but any help is appreciated!