- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_stringstream.cpp
More file actions
Latest commit
27 lines (24 loc) · 642 Bytes
/
Copy pathbasic_stringstream.cpp
File metadata and controls
27 lines (24 loc) · 642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<iostream>
#include<sstream>
usingnamespacestd;
intmain(){
//istringstream example
cout << "==== istringstream example ====" << endl;
istringstream iss("zetwhite zetwhite@naver.com");
string id, mail;
iss >> id >> mail;
iss.clear();
cout << "id : " << id << endl;
cout << "mail : " << mail << endl;
cout << endl;
//ostringstream example
cout << "==== ostringstream example ====" << endl;
ostringstream oss;
int n = 10;
oss << "countdown from " << n << " : ";
for(int i = n; i >=0 ; i--){
oss << i << "";
}
cout << oss.str() << endl;
return0;
}