質問編集履歴
6
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,406 +6,378 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
希望としては、下記のもの2文字の場合のものですが、取り出した文字の組とその出現回数をカウントした数をファイルに書き込みたいと考えています。
|
10
|
-
|
11
|
-
|
12
|
-
|
13
9
|
ご指摘をお願いします。
|
14
10
|
|
15
11
|
|
16
12
|
|
13
|
+
usethisfile.txt
|
14
|
+
|
17
15
|
```ここに言語を入力
|
18
16
|
|
19
|
-
en
|
20
|
-
|
21
|
-
nd
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
th
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
p
|
30
|
-
|
31
|
-
ro
|
32
|
-
|
33
|
-
o
|
17
|
+
end of the project gutenberg ebook of the lincoln country in pictures by
|
18
|
+
|
19
|
+
carl frazier and rosalie frazier
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end of this project gutenberg ebook the lincoln country in pictures
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
this file should be named h htm or h zip
|
28
|
+
|
29
|
+
this and all associated files of various formats will be found in
|
30
|
+
|
31
|
+
http www gutenberg org
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
produced by stephen hutcheson and the online distributed
|
36
|
+
|
37
|
+
proofreading team at http www pgdp net
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
updated editions will replace the previous one the old editions will
|
42
|
+
|
43
|
+
be renamed
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
creating the works from print editions not protected by u s copyright
|
48
|
+
|
49
|
+
law means that no one owns a united states copyright in these works
|
50
|
+
|
51
|
+
so the foundation and you can copy and distribute it in the united
|
52
|
+
|
53
|
+
states without permission and without paying copyright
|
54
|
+
|
55
|
+
royalties special rules set forth in the general terms of use part
|
56
|
+
|
57
|
+
of this license apply to copying and distributing project
|
58
|
+
|
59
|
+
gutenberg tm electronic works to protect the project gutenberg tm
|
60
|
+
|
61
|
+
concept and trademark project gutenberg is a registered trademark
|
62
|
+
|
63
|
+
and may not be used if you charge for the ebooks unless you receive
|
64
|
+
|
65
|
+
specific permission if you do not charge anything for copies of this
|
66
|
+
|
67
|
+
ebook complying with the rules is very easy you may use this ebook
|
68
|
+
|
69
|
+
for nearly any purpose such as creation of derivative works reports
|
70
|
+
|
71
|
+
performances and research they may be modified and printed and given
|
72
|
+
|
73
|
+
away you may do practically anything in the united states with ebooks
|
74
|
+
|
75
|
+
not protected by u s copyright law redistribution is subject to the
|
76
|
+
|
77
|
+
trademark license especially commercial redistribution
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
start full license
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
the full project gutenberg license
|
86
|
+
|
87
|
+
please read this before you distribute or use this work
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
to protect the project gutenberg tm mission of promoting the free
|
92
|
+
|
93
|
+
distribution of electronic works by using or distributing this work
|
94
|
+
|
95
|
+
or any other work associated in any way with the phrase project
|
96
|
+
|
97
|
+
gutenberg you agree to comply with all the terms of the full
|
98
|
+
|
99
|
+
project gutenberg tm license available with this file or online at
|
100
|
+
|
101
|
+
www gutenberg org license
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
section general terms of use and redistributing project
|
106
|
+
|
107
|
+
gutenberg tm electronic works
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
a by reading or using any part of this project gutenberg tm
|
112
|
+
|
113
|
+
electronic work you indicate that you have read understand agree to
|
114
|
+
|
115
|
+
and accept all the terms of this license and intellectual property
|
116
|
+
|
117
|
+
trademark copyright agreement if you do not agree to abide by all
|
118
|
+
|
119
|
+
the terms of this agreement you must cease using and return or
|
120
|
+
|
121
|
+
destroy all copies of project gutenberg tm electronic works in your
|
122
|
+
|
123
|
+
possession if you paid a fee for obtaining a copy of or access to a
|
124
|
+
|
125
|
+
project gutenberg tm electronic work and you do not agree to be bound
|
126
|
+
|
127
|
+
by the terms of this agreement you may obtain a refund from the
|
128
|
+
|
129
|
+
person or entity to whom you paid the fee as set forth in paragraph
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
main.c
|
138
|
+
|
139
|
+
```ここに言語を入力
|
140
|
+
|
141
|
+
1 #include<stdio.h>
|
142
|
+
|
143
|
+
2
|
144
|
+
|
145
|
+
3 int main(void){
|
146
|
+
|
147
|
+
4
|
148
|
+
|
149
|
+
5 FILE *fp;
|
150
|
+
|
151
|
+
6 int three[17576][4]= {{0}}, i=0, j=0;
|
152
|
+
|
153
|
+
7 char word[256]={};
|
154
|
+
|
155
|
+
8
|
156
|
+
|
157
|
+
9 fp = fopen("usethisfile.txt", "r");
|
158
|
+
|
159
|
+
10
|
160
|
+
|
161
|
+
11
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
12 while(fgets(word, 256, fp) != NULL){
|
166
|
+
|
167
|
+
13 while(word[i] != 0x00){
|
168
|
+
|
169
|
+
14 do{
|
170
|
+
|
171
|
+
15 if(((three[j][0]==word[i]) && (three[j][1]==word[i+1])) && (three[j][2]==word[i+2])){
|
172
|
+
|
173
|
+
16 three[j][3]++;
|
174
|
+
|
175
|
+
17 break;
|
176
|
+
|
177
|
+
18 }
|
178
|
+
|
179
|
+
19 else if(three[j][0]==0){
|
180
|
+
|
181
|
+
20 three[j][0] = word[i];
|
182
|
+
|
183
|
+
21 three[j][1] = word[i+1];
|
184
|
+
|
185
|
+
22 three[j][2] = word[i+2];
|
186
|
+
|
187
|
+
23 three[j][3]++;
|
188
|
+
|
189
|
+
24 break;
|
190
|
+
|
191
|
+
25 }
|
192
|
+
|
193
|
+
26 }while(three[j++][0] != 0);
|
194
|
+
|
195
|
+
27 j=0;
|
196
|
+
|
197
|
+
28 i++;
|
198
|
+
|
199
|
+
29 }
|
200
|
+
|
201
|
+
30 i=0;
|
202
|
+
|
203
|
+
31
|
204
|
+
|
205
|
+
32 }
|
206
|
+
|
207
|
+
33
|
208
|
+
|
209
|
+
34 fclose(fp);
|
210
|
+
|
211
|
+
35 fp = fopen("filethree.txt", "w");
|
212
|
+
|
213
|
+
36
|
214
|
+
|
215
|
+
37 i=0;
|
216
|
+
|
217
|
+
38 while(three[i][0] != 0){
|
218
|
+
|
219
|
+
39 fprintf(fp, "%c%c%c %d\n", three[i][0], three[i][1], three[i][2], three[i][3]);
|
220
|
+
|
221
|
+
40 i++;
|
222
|
+
|
223
|
+
41 }
|
224
|
+
|
225
|
+
42 fclose(fp);
|
226
|
+
|
227
|
+
43
|
228
|
+
|
229
|
+
44 return 0;
|
230
|
+
|
231
|
+
45 }
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
```
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
ファイル出力結果
|
240
|
+
|
241
|
+
```ここに言語を入力
|
242
|
+
|
243
|
+
end 2
|
244
|
+
|
245
|
+
nd 22
|
246
|
+
|
247
|
+
d o 2
|
248
|
+
|
249
|
+
of 17
|
250
|
+
|
251
|
+
of 18
|
252
|
+
|
253
|
+
f t 10
|
254
|
+
|
255
|
+
th 41
|
256
|
+
|
257
|
+
the 29
|
258
|
+
|
259
|
+
he 24
|
260
|
+
|
261
|
+
e p 6
|
262
|
+
|
263
|
+
pr 21
|
264
|
+
|
265
|
+
pro 21
|
266
|
+
|
267
|
+
roj 13
|
268
|
+
|
269
|
+
oje 13
|
270
|
+
|
271
|
+
jec 14
|
272
|
+
|
273
|
+
ect 26
|
274
|
+
|
275
|
+
ct 13
|
276
|
+
|
277
|
+
t g 10
|
278
|
+
|
279
|
+
gu 12
|
280
|
+
|
281
|
+
gut 15
|
282
|
+
|
283
|
+
ute 18
|
284
|
+
|
285
|
+
ten 15
|
286
|
+
|
287
|
+
enb 15
|
288
|
+
|
289
|
+
nbe 15
|
290
|
+
|
291
|
+
ber 15
|
292
|
+
|
293
|
+
erg 15
|
294
|
+
|
295
|
+
rg 17
|
296
|
+
|
297
|
+
g e 2
|
298
|
+
|
299
|
+
eb 5
|
300
|
+
|
301
|
+
ebo 6
|
302
|
+
|
303
|
+
boo 6
|
304
|
+
|
305
|
+
ook 6
|
306
|
+
|
307
|
+
ok 3
|
308
|
+
|
309
|
+
k o 1
|
310
|
+
|
311
|
+
e l 2
|
312
|
+
|
313
|
+
li 9
|
314
|
+
|
315
|
+
lin 4
|
316
|
+
|
317
|
+
inc 2
|
318
|
+
|
319
|
+
nco 2
|
320
|
+
|
321
|
+
col 2
|
322
|
+
|
323
|
+
oln 2
|
324
|
+
|
325
|
+
ln 2
|
326
|
+
|
327
|
+
n c 3
|
328
|
+
|
329
|
+
co 15
|
330
|
+
|
331
|
+
cou 2
|
332
|
+
|
333
|
+
oun 5
|
334
|
+
|
335
|
+
unt 2
|
336
|
+
|
337
|
+
ntr 2
|
338
|
+
|
339
|
+
try 2
|
340
|
+
|
341
|
+
ry 3
|
342
|
+
|
343
|
+
y i 2
|
344
|
+
|
345
|
+
in 12
|
346
|
+
|
347
|
+
in 11
|
348
|
+
|
349
|
+
n p 3
|
350
|
+
|
351
|
+
pi 2
|
352
|
+
|
353
|
+
pic 2
|
354
|
+
|
355
|
+
ict 2
|
356
|
+
|
357
|
+
ctu 3
|
358
|
+
|
359
|
+
tur 3
|
360
|
+
|
361
|
+
ure 2
|
362
|
+
|
363
|
+
res 3
|
364
|
+
|
365
|
+
es 12
|
366
|
+
|
367
|
+
s 9
|
368
|
+
|
369
|
+
b 3
|
370
|
+
|
371
|
+
by 7
|
372
|
+
|
373
|
+
by 8
|
374
|
+
|
375
|
+
y 1
|
376
|
+
|
377
|
+
\00 11
|
378
|
+
|
379
|
+
\00\00 15
|
34
380
|
|
35
381
|
...
|
36
382
|
|
37
383
|
```
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
usethisfile.txt
|
42
|
-
|
43
|
-
```ここに言語を入力
|
44
|
-
|
45
|
-
end of the project gutenberg ebook of the lincoln country in pictures by
|
46
|
-
|
47
|
-
carl frazier and rosalie frazier
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end of this project gutenberg ebook the lincoln country in pictures
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
this file should be named h htm or h zip
|
56
|
-
|
57
|
-
this and all associated files of various formats will be found in
|
58
|
-
|
59
|
-
http www gutenberg org
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
produced by stephen hutcheson and the online distributed
|
64
|
-
|
65
|
-
proofreading team at http www pgdp net
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
updated editions will replace the previous one the old editions will
|
70
|
-
|
71
|
-
be renamed
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
creating the works from print editions not protected by u s copyright
|
76
|
-
|
77
|
-
law means that no one owns a united states copyright in these works
|
78
|
-
|
79
|
-
so the foundation and you can copy and distribute it in the united
|
80
|
-
|
81
|
-
states without permission and without paying copyright
|
82
|
-
|
83
|
-
royalties special rules set forth in the general terms of use part
|
84
|
-
|
85
|
-
of this license apply to copying and distributing project
|
86
|
-
|
87
|
-
gutenberg tm electronic works to protect the project gutenberg tm
|
88
|
-
|
89
|
-
concept and trademark project gutenberg is a registered trademark
|
90
|
-
|
91
|
-
and may not be used if you charge for the ebooks unless you receive
|
92
|
-
|
93
|
-
specific permission if you do not charge anything for copies of this
|
94
|
-
|
95
|
-
ebook complying with the rules is very easy you may use this ebook
|
96
|
-
|
97
|
-
for nearly any purpose such as creation of derivative works reports
|
98
|
-
|
99
|
-
performances and research they may be modified and printed and given
|
100
|
-
|
101
|
-
away you may do practically anything in the united states with ebooks
|
102
|
-
|
103
|
-
not protected by u s copyright law redistribution is subject to the
|
104
|
-
|
105
|
-
trademark license especially commercial redistribution
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
start full license
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
the full project gutenberg license
|
114
|
-
|
115
|
-
please read this before you distribute or use this work
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
to protect the project gutenberg tm mission of promoting the free
|
120
|
-
|
121
|
-
distribution of electronic works by using or distributing this work
|
122
|
-
|
123
|
-
or any other work associated in any way with the phrase project
|
124
|
-
|
125
|
-
gutenberg you agree to comply with all the terms of the full
|
126
|
-
|
127
|
-
project gutenberg tm license available with this file or online at
|
128
|
-
|
129
|
-
www gutenberg org license
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
section general terms of use and redistributing project
|
134
|
-
|
135
|
-
gutenberg tm electronic works
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
a by reading or using any part of this project gutenberg tm
|
140
|
-
|
141
|
-
electronic work you indicate that you have read understand agree to
|
142
|
-
|
143
|
-
and accept all the terms of this license and intellectual property
|
144
|
-
|
145
|
-
trademark copyright agreement if you do not agree to abide by all
|
146
|
-
|
147
|
-
the terms of this agreement you must cease using and return or
|
148
|
-
|
149
|
-
destroy all copies of project gutenberg tm electronic works in your
|
150
|
-
|
151
|
-
possession if you paid a fee for obtaining a copy of or access to a
|
152
|
-
|
153
|
-
project gutenberg tm electronic work and you do not agree to be bound
|
154
|
-
|
155
|
-
by the terms of this agreement you may obtain a refund from the
|
156
|
-
|
157
|
-
person or entity to whom you paid the fee as set forth in paragraph
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
```
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
main.c
|
166
|
-
|
167
|
-
```ここに言語を入力
|
168
|
-
|
169
|
-
1 #include<stdio.h>
|
170
|
-
|
171
|
-
2
|
172
|
-
|
173
|
-
3 int main(void){
|
174
|
-
|
175
|
-
4
|
176
|
-
|
177
|
-
5 FILE *fp;
|
178
|
-
|
179
|
-
6 int three[17576][4]= {{0}}, i=0, j=0;
|
180
|
-
|
181
|
-
7 char word[256]={};
|
182
|
-
|
183
|
-
8
|
184
|
-
|
185
|
-
9 fp = fopen("usethisfile.txt", "r");
|
186
|
-
|
187
|
-
10
|
188
|
-
|
189
|
-
11
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
12 while(fgets(word, 256, fp) != NULL){
|
194
|
-
|
195
|
-
13 while(word[i] != 0x00){
|
196
|
-
|
197
|
-
14 do{
|
198
|
-
|
199
|
-
15 if(((three[j][0]==word[i]) && (three[j][1]==word[i+1])) && (three[j][2]==word[i+2])){
|
200
|
-
|
201
|
-
16 three[j][3]++;
|
202
|
-
|
203
|
-
17 break;
|
204
|
-
|
205
|
-
18 }
|
206
|
-
|
207
|
-
19 else if(three[j][0]==0){
|
208
|
-
|
209
|
-
20 three[j][0] = word[i];
|
210
|
-
|
211
|
-
21 three[j][1] = word[i+1];
|
212
|
-
|
213
|
-
22 three[j][2] = word[i+2];
|
214
|
-
|
215
|
-
23 three[j][3]++;
|
216
|
-
|
217
|
-
24 break;
|
218
|
-
|
219
|
-
25 }
|
220
|
-
|
221
|
-
26 }while(three[j++][0] != 0);
|
222
|
-
|
223
|
-
27 j=0;
|
224
|
-
|
225
|
-
28 i++;
|
226
|
-
|
227
|
-
29 }
|
228
|
-
|
229
|
-
30 i=0;
|
230
|
-
|
231
|
-
31
|
232
|
-
|
233
|
-
32 }
|
234
|
-
|
235
|
-
33
|
236
|
-
|
237
|
-
34 fclose(fp);
|
238
|
-
|
239
|
-
35 fp = fopen("filethree.txt", "w");
|
240
|
-
|
241
|
-
36
|
242
|
-
|
243
|
-
37 i=0;
|
244
|
-
|
245
|
-
38 while(three[i][0] != 0){
|
246
|
-
|
247
|
-
39 fprintf(fp, "%c%c%c %d\n", three[i][0], three[i][1], three[i][2], three[i][3]);
|
248
|
-
|
249
|
-
40 i++;
|
250
|
-
|
251
|
-
41 }
|
252
|
-
|
253
|
-
42 fclose(fp);
|
254
|
-
|
255
|
-
43
|
256
|
-
|
257
|
-
44 return 0;
|
258
|
-
|
259
|
-
45 }
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
```
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
ファイル出力結果
|
268
|
-
|
269
|
-
```ここに言語を入力
|
270
|
-
|
271
|
-
end 2
|
272
|
-
|
273
|
-
nd 22
|
274
|
-
|
275
|
-
d o 2
|
276
|
-
|
277
|
-
of 17
|
278
|
-
|
279
|
-
of 18
|
280
|
-
|
281
|
-
f t 10
|
282
|
-
|
283
|
-
th 41
|
284
|
-
|
285
|
-
the 29
|
286
|
-
|
287
|
-
he 24
|
288
|
-
|
289
|
-
e p 6
|
290
|
-
|
291
|
-
pr 21
|
292
|
-
|
293
|
-
pro 21
|
294
|
-
|
295
|
-
roj 13
|
296
|
-
|
297
|
-
oje 13
|
298
|
-
|
299
|
-
jec 14
|
300
|
-
|
301
|
-
ect 26
|
302
|
-
|
303
|
-
ct 13
|
304
|
-
|
305
|
-
t g 10
|
306
|
-
|
307
|
-
gu 12
|
308
|
-
|
309
|
-
gut 15
|
310
|
-
|
311
|
-
ute 18
|
312
|
-
|
313
|
-
ten 15
|
314
|
-
|
315
|
-
enb 15
|
316
|
-
|
317
|
-
nbe 15
|
318
|
-
|
319
|
-
ber 15
|
320
|
-
|
321
|
-
erg 15
|
322
|
-
|
323
|
-
rg 17
|
324
|
-
|
325
|
-
g e 2
|
326
|
-
|
327
|
-
eb 5
|
328
|
-
|
329
|
-
ebo 6
|
330
|
-
|
331
|
-
boo 6
|
332
|
-
|
333
|
-
ook 6
|
334
|
-
|
335
|
-
ok 3
|
336
|
-
|
337
|
-
k o 1
|
338
|
-
|
339
|
-
e l 2
|
340
|
-
|
341
|
-
li 9
|
342
|
-
|
343
|
-
lin 4
|
344
|
-
|
345
|
-
inc 2
|
346
|
-
|
347
|
-
nco 2
|
348
|
-
|
349
|
-
col 2
|
350
|
-
|
351
|
-
oln 2
|
352
|
-
|
353
|
-
ln 2
|
354
|
-
|
355
|
-
n c 3
|
356
|
-
|
357
|
-
co 15
|
358
|
-
|
359
|
-
cou 2
|
360
|
-
|
361
|
-
oun 5
|
362
|
-
|
363
|
-
unt 2
|
364
|
-
|
365
|
-
ntr 2
|
366
|
-
|
367
|
-
try 2
|
368
|
-
|
369
|
-
ry 3
|
370
|
-
|
371
|
-
y i 2
|
372
|
-
|
373
|
-
in 12
|
374
|
-
|
375
|
-
in 11
|
376
|
-
|
377
|
-
n p 3
|
378
|
-
|
379
|
-
pi 2
|
380
|
-
|
381
|
-
pic 2
|
382
|
-
|
383
|
-
ict 2
|
384
|
-
|
385
|
-
ctu 3
|
386
|
-
|
387
|
-
tur 3
|
388
|
-
|
389
|
-
ure 2
|
390
|
-
|
391
|
-
res 3
|
392
|
-
|
393
|
-
es 12
|
394
|
-
|
395
|
-
s 9
|
396
|
-
|
397
|
-
b 3
|
398
|
-
|
399
|
-
by 7
|
400
|
-
|
401
|
-
by 8
|
402
|
-
|
403
|
-
y 1
|
404
|
-
|
405
|
-
\00 11
|
406
|
-
|
407
|
-
\00\00 15
|
408
|
-
|
409
|
-
...
|
410
|
-
|
411
|
-
```
|
5
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ファイルから
|
1
|
+
ファイルから文字を取り出し、出現頻度をカウント
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Cを用いてASCIIで書かれているファイルからアルファベットとスペース区切り、改行のみの文字列を読み込み、
|
1
|
+
Cを用いてASCIIで書かれているファイルからアルファベットとスペース区切り、改行のみの文字列を読み込み、文字の組にして取り出し、出現頻度をカウントしたいと思っています。
|
2
2
|
|
3
3
|
|
4
4
|
|
4
ソースコードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
5 FILE *fp;
|
178
178
|
|
179
|
-
6 int three[156
|
179
|
+
6 int three[17576][4]= {{0}}, i=0, j=0;
|
180
180
|
|
181
181
|
7 char word[256]={};
|
182
182
|
|
3
ソースコードの修正、 出力結果の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
取り出した文字の組とその出現回数をファイルに出力したのですが、
|
5
|
+
取り出した文字の組とその出現回数をファイルに出力したのですが、一部文字化けを起こしてしまいます。
|
6
6
|
|
7
7
|
|
8
8
|
|
@@ -164,108 +164,248 @@
|
|
164
164
|
|
165
165
|
main.c
|
166
166
|
|
167
|
+
```ここに言語を入力
|
168
|
+
|
169
|
+
1 #include<stdio.h>
|
170
|
+
|
171
|
+
2
|
172
|
+
|
173
|
+
3 int main(void){
|
174
|
+
|
175
|
+
4
|
176
|
+
|
177
|
+
5 FILE *fp;
|
178
|
+
|
179
|
+
6 int three[15625][4] = {{0}}, i=0, j=0;
|
180
|
+
|
181
|
+
7 char word[256]={};
|
182
|
+
|
183
|
+
8
|
184
|
+
|
185
|
+
9 fp = fopen("usethisfile.txt", "r");
|
186
|
+
|
187
|
+
10
|
188
|
+
|
189
|
+
11
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
12 while(fgets(word, 256, fp) != NULL){
|
194
|
+
|
195
|
+
13 while(word[i] != 0x00){
|
196
|
+
|
197
|
+
14 do{
|
198
|
+
|
199
|
+
15 if(((three[j][0]==word[i]) && (three[j][1]==word[i+1])) && (three[j][2]==word[i+2])){
|
200
|
+
|
201
|
+
16 three[j][3]++;
|
202
|
+
|
203
|
+
17 break;
|
204
|
+
|
205
|
+
18 }
|
206
|
+
|
207
|
+
19 else if(three[j][0]==0){
|
208
|
+
|
209
|
+
20 three[j][0] = word[i];
|
210
|
+
|
211
|
+
21 three[j][1] = word[i+1];
|
212
|
+
|
213
|
+
22 three[j][2] = word[i+2];
|
214
|
+
|
215
|
+
23 three[j][3]++;
|
216
|
+
|
217
|
+
24 break;
|
218
|
+
|
219
|
+
25 }
|
220
|
+
|
221
|
+
26 }while(three[j++][0] != 0);
|
222
|
+
|
223
|
+
27 j=0;
|
224
|
+
|
225
|
+
28 i++;
|
226
|
+
|
227
|
+
29 }
|
228
|
+
|
229
|
+
30 i=0;
|
230
|
+
|
231
|
+
31
|
232
|
+
|
233
|
+
32 }
|
234
|
+
|
235
|
+
33
|
236
|
+
|
237
|
+
34 fclose(fp);
|
238
|
+
|
239
|
+
35 fp = fopen("filethree.txt", "w");
|
240
|
+
|
241
|
+
36
|
242
|
+
|
243
|
+
37 i=0;
|
244
|
+
|
245
|
+
38 while(three[i][0] != 0){
|
246
|
+
|
247
|
+
39 fprintf(fp, "%c%c%c %d\n", three[i][0], three[i][1], three[i][2], three[i][3]);
|
248
|
+
|
249
|
+
40 i++;
|
250
|
+
|
251
|
+
41 }
|
252
|
+
|
253
|
+
42 fclose(fp);
|
254
|
+
|
255
|
+
43
|
256
|
+
|
257
|
+
44 return 0;
|
258
|
+
|
259
|
+
45 }
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
ファイル出力結果
|
268
|
+
|
167
269
|
```ここに言語を入力
|
168
270
|
|
169
|
-
|
170
|
-
|
171
|
-
2
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
1
|
190
|
-
|
191
|
-
1
|
192
|
-
|
193
|
-
13
|
194
|
-
|
195
|
-
1
|
196
|
-
|
197
|
-
1
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
1
|
202
|
-
|
203
|
-
1
|
204
|
-
|
205
|
-
1
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
2
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
271
|
+
end 2
|
272
|
+
|
273
|
+
nd 22
|
274
|
+
|
275
|
+
d o 2
|
276
|
+
|
277
|
+
of 17
|
278
|
+
|
279
|
+
of 18
|
280
|
+
|
281
|
+
f t 10
|
282
|
+
|
283
|
+
th 41
|
284
|
+
|
285
|
+
the 29
|
286
|
+
|
287
|
+
he 24
|
288
|
+
|
289
|
+
e p 6
|
290
|
+
|
291
|
+
pr 21
|
292
|
+
|
293
|
+
pro 21
|
294
|
+
|
295
|
+
roj 13
|
296
|
+
|
297
|
+
oje 13
|
298
|
+
|
299
|
+
jec 14
|
300
|
+
|
301
|
+
ect 26
|
302
|
+
|
303
|
+
ct 13
|
304
|
+
|
305
|
+
t g 10
|
306
|
+
|
307
|
+
gu 12
|
308
|
+
|
309
|
+
gut 15
|
310
|
+
|
311
|
+
ute 18
|
312
|
+
|
313
|
+
ten 15
|
314
|
+
|
315
|
+
enb 15
|
316
|
+
|
317
|
+
nbe 15
|
318
|
+
|
319
|
+
ber 15
|
320
|
+
|
321
|
+
erg 15
|
322
|
+
|
323
|
+
rg 17
|
324
|
+
|
325
|
+
g e 2
|
326
|
+
|
327
|
+
eb 5
|
328
|
+
|
329
|
+
ebo 6
|
330
|
+
|
331
|
+
boo 6
|
332
|
+
|
333
|
+
ook 6
|
334
|
+
|
335
|
+
ok 3
|
336
|
+
|
337
|
+
k o 1
|
338
|
+
|
339
|
+
e l 2
|
340
|
+
|
341
|
+
li 9
|
342
|
+
|
343
|
+
lin 4
|
344
|
+
|
345
|
+
inc 2
|
346
|
+
|
347
|
+
nco 2
|
348
|
+
|
349
|
+
col 2
|
350
|
+
|
351
|
+
oln 2
|
352
|
+
|
353
|
+
ln 2
|
354
|
+
|
355
|
+
n c 3
|
356
|
+
|
357
|
+
co 15
|
358
|
+
|
359
|
+
cou 2
|
360
|
+
|
361
|
+
oun 5
|
362
|
+
|
363
|
+
unt 2
|
364
|
+
|
365
|
+
ntr 2
|
366
|
+
|
367
|
+
try 2
|
368
|
+
|
369
|
+
ry 3
|
370
|
+
|
371
|
+
y i 2
|
372
|
+
|
373
|
+
in 12
|
374
|
+
|
375
|
+
in 11
|
376
|
+
|
377
|
+
n p 3
|
378
|
+
|
379
|
+
pi 2
|
380
|
+
|
381
|
+
pic 2
|
382
|
+
|
383
|
+
ict 2
|
384
|
+
|
385
|
+
ctu 3
|
386
|
+
|
387
|
+
tur 3
|
388
|
+
|
389
|
+
ure 2
|
390
|
+
|
391
|
+
res 3
|
392
|
+
|
393
|
+
es 12
|
394
|
+
|
395
|
+
s 9
|
396
|
+
|
397
|
+
b 3
|
398
|
+
|
399
|
+
by 7
|
400
|
+
|
401
|
+
by 8
|
402
|
+
|
403
|
+
y 1
|
404
|
+
|
405
|
+
\00 11
|
406
|
+
|
407
|
+
\00\00 15
|
408
|
+
|
409
|
+
...
|
270
410
|
|
271
411
|
```
|
2
希望動作の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,35 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
希望としては、下記のもの2文字の場合のものですが、取り出した文字の組とその出現回数をカウントした数をファイルに書き込みたいと考えています。
|
10
|
+
|
11
|
+
|
12
|
+
|
9
|
-
|
13
|
+
ご指摘をお願いします。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
```ここに言語を入力
|
18
|
+
|
19
|
+
en 198
|
20
|
+
|
21
|
+
nd 138
|
22
|
+
|
23
|
+
of 129
|
24
|
+
|
25
|
+
th 349
|
26
|
+
|
27
|
+
he 228
|
28
|
+
|
29
|
+
pr 149
|
30
|
+
|
31
|
+
ro 191
|
32
|
+
|
33
|
+
oj 85
|
34
|
+
|
35
|
+
...
|
36
|
+
|
37
|
+
```
|
10
38
|
|
11
39
|
|
12
40
|
|
1
テキストファイルの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,130 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
usethisfile.txt
|
14
|
+
|
15
|
+
```ここに言語を入力
|
16
|
+
|
17
|
+
end of the project gutenberg ebook of the lincoln country in pictures by
|
18
|
+
|
19
|
+
carl frazier and rosalie frazier
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end of this project gutenberg ebook the lincoln country in pictures
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
this file should be named h htm or h zip
|
28
|
+
|
29
|
+
this and all associated files of various formats will be found in
|
30
|
+
|
31
|
+
http www gutenberg org
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
produced by stephen hutcheson and the online distributed
|
36
|
+
|
37
|
+
proofreading team at http www pgdp net
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
updated editions will replace the previous one the old editions will
|
42
|
+
|
43
|
+
be renamed
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
creating the works from print editions not protected by u s copyright
|
48
|
+
|
49
|
+
law means that no one owns a united states copyright in these works
|
50
|
+
|
51
|
+
so the foundation and you can copy and distribute it in the united
|
52
|
+
|
53
|
+
states without permission and without paying copyright
|
54
|
+
|
55
|
+
royalties special rules set forth in the general terms of use part
|
56
|
+
|
57
|
+
of this license apply to copying and distributing project
|
58
|
+
|
59
|
+
gutenberg tm electronic works to protect the project gutenberg tm
|
60
|
+
|
61
|
+
concept and trademark project gutenberg is a registered trademark
|
62
|
+
|
63
|
+
and may not be used if you charge for the ebooks unless you receive
|
64
|
+
|
65
|
+
specific permission if you do not charge anything for copies of this
|
66
|
+
|
67
|
+
ebook complying with the rules is very easy you may use this ebook
|
68
|
+
|
69
|
+
for nearly any purpose such as creation of derivative works reports
|
70
|
+
|
71
|
+
performances and research they may be modified and printed and given
|
72
|
+
|
73
|
+
away you may do practically anything in the united states with ebooks
|
74
|
+
|
75
|
+
not protected by u s copyright law redistribution is subject to the
|
76
|
+
|
77
|
+
trademark license especially commercial redistribution
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
start full license
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
the full project gutenberg license
|
86
|
+
|
87
|
+
please read this before you distribute or use this work
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
to protect the project gutenberg tm mission of promoting the free
|
92
|
+
|
93
|
+
distribution of electronic works by using or distributing this work
|
94
|
+
|
95
|
+
or any other work associated in any way with the phrase project
|
96
|
+
|
97
|
+
gutenberg you agree to comply with all the terms of the full
|
98
|
+
|
99
|
+
project gutenberg tm license available with this file or online at
|
100
|
+
|
101
|
+
www gutenberg org license
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
section general terms of use and redistributing project
|
106
|
+
|
107
|
+
gutenberg tm electronic works
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
a by reading or using any part of this project gutenberg tm
|
112
|
+
|
113
|
+
electronic work you indicate that you have read understand agree to
|
114
|
+
|
115
|
+
and accept all the terms of this license and intellectual property
|
116
|
+
|
117
|
+
trademark copyright agreement if you do not agree to abide by all
|
118
|
+
|
119
|
+
the terms of this agreement you must cease using and return or
|
120
|
+
|
121
|
+
destroy all copies of project gutenberg tm electronic works in your
|
122
|
+
|
123
|
+
possession if you paid a fee for obtaining a copy of or access to a
|
124
|
+
|
125
|
+
project gutenberg tm electronic work and you do not agree to be bound
|
126
|
+
|
127
|
+
by the terms of this agreement you may obtain a refund from the
|
128
|
+
|
129
|
+
person or entity to whom you paid the fee as set forth in paragraph
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
|
136
|
+
|
13
137
|
main.c
|
14
138
|
|
15
139
|
```ここに言語を入力
|