// Tokenizing a string using stringstream
#include <bits/stdc++.h>
using namespace std;
int main()
{
string line = "GeeksForGeeks is a must try";
// Vector of string to save tokens
vector <string> tokens;
// stringstream class check1
stringstream check1(line);
string intermediate;
// Tokenizing w.r.t. space ' '
while(getline(check1, intermediate, ' '))
{
tokens.push_back(intermediate);
}
// Printing the token vector
for(int i = 0; i < tokens.size(); i++)
cout << tokens[i] << '\n';
}
괜찮은지 아닌지는 과제 내주신 분에게
괜찮은지 아닌지는 과제 내주신 분에게 물어보셔야 할 듯.
세벌 https://sebuls.blogspot.kr/
https://www.geeksforgeeks.org
https://www.geeksforgeeks.org/tokenizing-a-string-cpp/
참고하세요.
_________________________
http://joone.net
https://kldp.org/blog/2725
http://opensoftware.tistory.com
http://joone4u.blogspot.com
https://gnome.or.kr
댓글 달기