Answers for "get rest of a stringstream c++"

C++
0

get rest of a stringstream c++

#include <iostream>
#include <sstream>

using namespace std;

int main() {
        stringstream ss("abc gg rrr ff");
        string s1, s2;
        ss >> s1;
        getline(ss, s2); //get rest of the string!
        cout << s1 << endl;
        cout << s2 << endl;
        return 0;
}
Posted by: Guest on September-23-2021

Browse Popular Code Answers by Language