質問編集履歴
2
こんぱいるできる形に変更しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
アドバイスをいただけないでしょうか?
|
10
10
|
|
11
|
-
###txt
|
11
|
+
###sample.txtの中身は以下です
|
12
12
|
```
|
13
13
|
Tokyo 1丁目 111-222
|
14
14
|
1
|
@@ -17,15 +17,22 @@
|
|
17
17
|
|
18
18
|
|
19
19
|
```C++
|
20
|
-
#include
|
20
|
+
#include<fstream>
|
21
|
+
#include<iostream>
|
22
|
+
#include<string>
|
21
|
-
|
23
|
+
using namespace std;
|
22
|
-
bool japan;
|
23
|
-
ifstream file;
|
24
|
-
file.open("sample.txt");
|
25
24
|
|
26
|
-
|
25
|
+
int main(){
|
27
|
-
getline(file, address);
|
28
|
-
file >> japan;
|
29
|
-
}
|
30
26
|
|
27
|
+
string address;
|
28
|
+
bool japan;
|
29
|
+
ifstream file;
|
30
|
+
file.open("sample.txt");
|
31
|
+
|
32
|
+
while(!file.eof()){
|
33
|
+
getline(file, address);
|
34
|
+
file >> japan;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
31
38
|
```
|
1
コードの変更と詳細の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,14 +7,25 @@
|
|
7
7
|
改善できませんでした。
|
8
8
|
|
9
9
|
アドバイスをいただけないでしょうか?
|
10
|
+
|
11
|
+
###txtファイルの中身は以下です
|
12
|
+
```
|
13
|
+
Tokyo 1丁目 111-222
|
14
|
+
1
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
|
10
19
|
```C++
|
11
20
|
#include <fstream>
|
21
|
+
string address;
|
22
|
+
bool japan;
|
12
23
|
ifstream file;
|
13
24
|
file.open("sample.txt");
|
14
25
|
|
15
26
|
while(!file.eof()){
|
16
27
|
getline(file, address);
|
17
|
-
file >>
|
28
|
+
file >> japan;
|
18
29
|
}
|
19
30
|
|
20
31
|
```
|