回答編集履歴

1

加筆

2016/09/06 06:15

投稿

episteme
episteme

スコア16614

test CHANGED
@@ -35,3 +35,57 @@
35
35
  }
36
36
 
37
37
  ```
38
+
39
+
40
+
41
+ 列分割版:
42
+
43
+ ```C++
44
+
45
+ #include <iostream>
46
+
47
+ #include <fstream>
48
+
49
+ #include <iterator>
50
+
51
+ #include <vector>
52
+
53
+ #include <utility>
54
+
55
+
56
+
57
+ namespace std {
58
+
59
+ std::istream& operator>>(std::istream& stream, std::pair<float,float>& ff) {
60
+
61
+ return stream >> ff.first >> ff.second;
62
+
63
+ }
64
+
65
+ }
66
+
67
+
68
+
69
+ int main() {
70
+
71
+ using namespace std;
72
+
73
+
74
+
75
+ vector<pair<float,float>> input((istream_iterator<pair<float,float>>(ifstream("datafile.dat"))), istream_iterator<pair<float,float>>());
76
+
77
+
78
+
79
+ // かくにん
80
+
81
+ for ( pair<float,float> item : input ) {
82
+
83
+ cout << item.first << '\t' << item.second << endl;
84
+
85
+ }
86
+
87
+ }
88
+
89
+ ```
90
+
91
+