From 26c490f404731d053a6205719b6246502c07b449 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 14 Jun 2014 16:46:27 +0200 Subject: init --- ccc/stringstream.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ccc/stringstream.cc (limited to 'ccc/stringstream.cc') diff --git a/ccc/stringstream.cc b/ccc/stringstream.cc new file mode 100644 index 0000000..3d68db3 --- /dev/null +++ b/ccc/stringstream.cc @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include +#include + +using namespace std; + + +int main(void) { + string s = "1 2 3 4"; + int i; + vector j; + stringstream ss(s); + while (ss >> i) { + j.push_back(i); + cout << i << endl; + } + + printf("%4d %4d %4d %4d\n", j[0], j[1], j[2], j[3]); + + cout.width(100); + cout << setw(100) << j.size() << endl; +} + -- cgit v1.2.3