Answers for "c++ string to vector int"

C++
-1

c++ string to vector int

#include <sstream>
#include <vector>
#include <string>

std::string myString = "10 15 20 23";
std::stringstream iss( myString );

int number;
std::vector<int> myNumbers;
while ( iss >> number )
  myNumbers.push_back( number );
Posted by: Guest on June-02-2020

Browse Popular Code Answers by Language