回答編集履歴
1
加筆
answer
CHANGED
@@ -16,4 +16,30 @@
|
|
16
16
|
cout << item << endl;
|
17
17
|
}
|
18
18
|
}
|
19
|
-
```
|
19
|
+
```
|
20
|
+
|
21
|
+
列分割版:
|
22
|
+
```C++
|
23
|
+
#include <iostream>
|
24
|
+
#include <fstream>
|
25
|
+
#include <iterator>
|
26
|
+
#include <vector>
|
27
|
+
#include <utility>
|
28
|
+
|
29
|
+
namespace std {
|
30
|
+
std::istream& operator>>(std::istream& stream, std::pair<float,float>& ff) {
|
31
|
+
return stream >> ff.first >> ff.second;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
int main() {
|
36
|
+
using namespace std;
|
37
|
+
|
38
|
+
vector<pair<float,float>> input((istream_iterator<pair<float,float>>(ifstream("datafile.dat"))), istream_iterator<pair<float,float>>());
|
39
|
+
|
40
|
+
// かくにん
|
41
|
+
for ( pair<float,float> item : input ) {
|
42
|
+
cout << item.first << '\t' << item.second << endl;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
```
|