Sort of like the String class split() function in Java? Does a similar easy alternative exist in C++?
You can use stringstream in c++.
vector<string> v;
string a,b;
getline(cin,a);
istringstream ss(a);
while(getline(ss,b,' ')){
v.push_back(b);
}
@ay2306 There isn’t a similar easier alternative then, I’m guessing. This is a more streamlined approach than using plain substrings (although underlying idea is same), so it’s not too bad.