You are viewing a single comment's thread. Return to all comments →
using namespace std;
vector parseInts(string str) { stringstream ss(str); char ch; int a; vector result; int count = 1; for(int i =0; i < str.length(); i ++) { if (str[i] == ',') { count++; } }
for(int i =0; i <count; i ++) { ss >> a >> ch ; result.push_back(a); } return result;
}
Seems like cookies are disabled on this browser, please enable them to open this website
StringStream
You are viewing a single comment's thread. Return to all comments →
include
include
include
using namespace std;
vector parseInts(string str) { stringstream ss(str); char ch; int a; vector result; int count = 1; for(int i =0; i < str.length(); i ++) { if (str[i] == ',') { count++; } }
}