1 개요[ | ]
- C++ stringstream
C++
CPU
0.4s
MEM
48M
0.4s
Copy
#include <iostream>
#include <sstream>
using namespace std;
int main () {
stringstream ss;
ss << 100 << ' ' << 200;
int foo,bar;
ss >> foo >> bar;
cout << foo << endl; // 100
cout << bar << endl; // 200
}
100 200
C++
Copy
#include <iostream>
#include <sstream>
using namespace std;
int main() {
stringstream ss("hello world");
string temp;
getline(ss, temp, ' ');
cout << temp << endl; // hello
getline(ss, temp, ' ');
cout << temp << endl; // world
}
Loading
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.