Answers for "how to read space separated string in c++"

C++
0

c++ split string by several space

std::string s = "split on    whitespace   "; 
std::vector<std::string> result; 
std::istringstream iss(s); 
for(std::string s; iss >> s; ) 
    result.push_back(s);
Posted by: Guest on December-18-2020
0

how to convert n space separated integers in c++

int i, n, arr[100];

scanf("%d", &n);
for (i = 0; i < n; ++i)
    scanf("%d", &arr[i]);
Posted by: Guest on June-28-2020

Code answers related to "how to read space separated string in c++"

Browse Popular Code Answers by Language