I'm trying to learn C++ as my first language and I want to apologies for my silly question. I want to fill two vectors with integers and display their sizes, but every time when check their number of elements I receive unexpected results.Perhaps I'm missing something fundamental.Here is my code:
`
#include<vector>
#include<string>
#include<iostream>
using namespace std;
int main(int argc, char** argv) {
string stop;
vector <int>adults;
vector <int>kids;
int int_var;
while (getline(cin, stop) && stop != "stop") {
cin>>int_var;
if (int_var > 16) {
adults.push_back(int_var);
}
else if (int_var <= 16) {
kids.push_back(int_var);
}
}
cout << "Number of adults: " << adults.size() << endl;
cout << "Number of kids: " << kids.size() << endl;
}
`
Every time in this crappy code the first value of int_var goes to second vector where must contain only numbers >16 .I'd be grateful if someone tells me where I'm wrong.