[Solved] Taking input of integers until a newline in C/C++ [duplicate]


Likely duplicate of: How to read groups of integers from a file, line by line in C++

If you want to deal in a line per line basis:

int main()
{
   std::string line;
   std::vector< std::vector<int> > all_integers;
   while ( getline( std::cin, line ) ) {
      std::istringstream is( line );
      all_integers.push_back( 
            std::vector<int>( std::istream_iterator<int>(is),
                              std::istream_iterator<int>() ) );
   }
}

solved Taking input of integers until a newline in C/C++ [duplicate]