how to read int in a vector of unknown size in c++ code example
Example: how to input a vector when size is unknown
#include <string>
#include <vector>
#include <sstream>
#include <string>
int main()
{
std::vector<int> vec;
std::string buffer;
int data;
std::getline(std::cin, buffer);
std::istringstream iss(buffer);
while (iss >> data)
vec.push_back(data);
//foo(vec);
}