Limiting number of elements in vector
问题 Trying to limit the amount of inputs that a user could insert into a vector when inputting an array into 1 manually, but for some reason it's being weird. #include <iostream> using namespace std; void fillVector(vector<int>& newThisIsAVector) { cout << "Please type in your 10 numbers separated by a space. On completion press enter."; int input; cin >> input; while (newThisIsAVector.size() < 10) { newThisIsAVector.push_back(input); cin >> input; } cout << endl; } It's supposed to limit you at