回答編集履歴

1

修正

2018/01/27 23:25

投稿

episteme
episteme

スコア16614

test CHANGED
@@ -4,7 +4,11 @@
4
4
 
5
5
  #include <sstream>
6
6
 
7
+ #include <iterator>
8
+
7
9
  #include <iostream>
10
+
11
+ #include <vector>
8
12
 
9
13
 
10
14
 
@@ -18,20 +22,16 @@
18
22
 
19
23
 
20
24
 
21
- int a, b, c;
25
+ vector<int> data(istream_iterator<int>{istringstream(str)},istream_iterator<int>{});
22
26
 
23
- istringstream stream(str);
24
27
 
25
- stream >> a >> b >> c;
26
28
 
27
- cout << a << endl
29
+ for ( auto item : data ) {
28
30
 
29
- << b << endl
31
+ cout << item << endl;
30
32
 
31
- << c << endl;
33
+ }
32
34
 
33
35
  }
34
36
 
35
-
36
-
37
37
  ```