blob: 3d68db3647eff84e339603a9b77abb1b2f227585 (
plain)
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
|
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <stdio.h>
#include <iomanip>
using namespace std;
int main(void) {
string s = "1 2 3 4";
int i;
vector<int> 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;
}
|