質問編集履歴

4

誤字

2016/03/20 04:47

投稿

Inabahitsuji
Inabahitsuji

スコア8

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  win10
32
32
 
33
- visualStudio2915
33
+ visualStudio2015
34
34
 
35
35
 
36
36
 

3

追記

2016/03/20 04:47

投稿

Inabahitsuji
Inabahitsuji

スコア8

test CHANGED
File without changes
test CHANGED
@@ -16,6 +16,96 @@
16
16
 
17
17
 
18
18
 
19
+ ・追記・
20
+
21
+ 質問内容の指摘ありがとうございます、こういった場で尋ねるのは初めてでどうお聞きすればいいのかさえ分からず本当に申し訳ありません…。
22
+
23
+
24
+
25
+ 新しく作る「新規作成機能」は下記の「追加機能」を利用したいのですが、そのままでは上記の機能説明で言うところの「新規作成」と「追加」を同時に行ってしまうため、新規作成で入力・追加で格納するといった形にしたいのです。
26
+
27
+
28
+
29
+ 構築環境
30
+
31
+ win10
32
+
33
+ visualStudio2915
34
+
35
+
36
+
37
+
38
+
39
+ 「実行結果のイメージ」
40
+
41
+ メニューを入力して下さい
42
+
43
+ 1.新規作成2.追加3.ソート4.終了
44
+
45
+ 1
46
+
47
+ 番号:xx
48
+
49
+ 氏名:yy
50
+
51
+ 得点:zz
52
+
53
+
54
+
55
+ 新規作成が完了しました
56
+
57
+ このデータを追加する場合はメニューにて追加を選択して下さい
58
+
59
+
60
+
61
+ メニューを入力して下さい
62
+
63
+ 1.新規作成2.追加3.ソート4.終了
64
+
65
+
66
+
67
+ まだ追加されていないデータがありますがよろしいですか?
68
+
69
+ 1.はい2.いいえ
70
+
71
+ 2
72
+
73
+
74
+
75
+ メニューを入力して下さい
76
+
77
+ 1.新規作成2.追加3.ソート4.終了
78
+
79
+ 2
80
+
81
+
82
+
83
+ 追加が完了しました
84
+
85
+
86
+
87
+ メニューを入力して下さい
88
+
89
+ 1.新規作成2.追加3.ソート4.終了
90
+
91
+ 3
92
+
93
+
94
+
95
+ 追加されたデータのソートを行います
96
+
97
+ 1.番号順2.得点順
98
+
99
+ 1
100
+
101
+
102
+
103
+ 番号1 氏名xx 得点yy
104
+
105
+
106
+
107
+
108
+
19
109
 
20
110
 
21
111
 

2

誤字

2016/03/20 04:29

投稿

Inabahitsuji
Inabahitsuji

スコア8

test CHANGED
File without changes
test CHANGED
@@ -196,144 +196,146 @@
196
196
 
197
197
 
198
198
 
199
+ if (cnt == DATASIZE) {
200
+
201
+ puts("これ以上追加できません");
202
+
203
+ return cnt;
204
+
205
+ }
206
+
207
+ printf("番号:");
208
+
209
+ gets(t->szNum);
210
+
211
+ printf("氏名:");
212
+
213
+ gets(t->szName);
214
+
215
+ printf("得点:");
216
+
217
+ gets(t->szPoint);
218
+
219
+
220
+
221
+ return cnt + 1;
222
+
223
+ }
224
+
225
+
226
+
227
+ int amend(Numress *ap, int cnt)
228
+
229
+ {
230
+
231
+ Numress *t;
232
+
233
+ char buf[BUFSIZE];
234
+
235
+ int i;
236
+
237
+
238
+
239
+ puts("何番を修正しますか?");
240
+
241
+ scanf("%d", &i); gets(buf);
242
+
243
+
244
+
245
+ if (i > 0 && i <= cnt) {
246
+
247
+ t = ap + i - 1; /* 配列のアドレスの計算 */
248
+
249
+ puts("変更しない場合は単に[return]を押して下さい");
250
+
251
+ printf("番号: %s -> ", t->szNum);
252
+
253
+ gets(buf);
254
+
255
+ if (strlen(buf)) strcpy(t->szNum, buf);
256
+
257
+ printf("氏名: %s -> ", t->szName);
258
+
259
+ gets(buf);
260
+
261
+ if (strlen(buf)) strcpy(t->szName, buf);
262
+
263
+ printf("得点: %s -> ", t->szPoint);
264
+
265
+ gets(buf);
266
+
267
+ if (strlen(buf)) strcpy(t->szPoint, buf);
268
+
269
+ }
270
+
271
+ else
272
+
273
+ puts("番号が不適切です");
274
+
275
+ return cnt;
276
+
277
+ }
278
+
279
+ int del(Numress *ap, int cnt)
280
+
281
+ {
282
+
283
+ char buf[BUFSIZE];
284
+
285
+ int i, j;
286
+
287
+
288
+
289
+ puts("何番を削除しますか?");
290
+
291
+ scanf("%d", &i); gets(buf);
292
+
293
+
294
+
295
+ if (i > 0 && i <= cnt) {
296
+
297
+ for (j = i - 1; j < cnt - 1; j++)
298
+
299
+ ap[j] = ap[j + 1];
300
+
301
+ return cnt - 1;
302
+
303
+ }
304
+
305
+
306
+
307
+ puts("番号が不適切です");
308
+
309
+ return cnt;
310
+
311
+ }
312
+
313
+
314
+
315
+
316
+
317
+ int printall(Numress *ap, int cnt)
318
+
319
+ {
320
+
321
+ int i = 0;
322
+
323
+
324
+
325
+ while (i < cnt) {
326
+
327
+ printf("%d: 番号:%s 氏名:%s 得点:%s\n", ++i, ap->szNum, ap->szName, ap->szPoint);
328
+
329
+ ap++;
330
+
331
+ }
332
+
333
+
334
+
335
+ return cnt;
336
+
337
+ }
338
+
339
+
340
+
199
341
  ```
200
-
201
- if (cnt == DATASIZE) {
202
-
203
- puts("これ以上追加できません");
204
-
205
- return cnt;
206
-
207
- }
208
-
209
- printf("番号:");
210
-
211
- gets(t->szNum);
212
-
213
- printf("氏名:");
214
-
215
- gets(t->szName);
216
-
217
- printf("得点:");
218
-
219
- gets(t->szPoint);
220
-
221
-
222
-
223
- return cnt + 1;
224
-
225
- }
226
-
227
-
228
-
229
- int amend(Numress *ap, int cnt)
230
-
231
- {
232
-
233
- Numress *t;
234
-
235
- char buf[BUFSIZE];
236
-
237
- int i;
238
-
239
-
240
-
241
- puts("何番を修正しますか?");
242
-
243
- scanf("%d", &i); gets(buf);
244
-
245
-
246
-
247
- if (i > 0 && i <= cnt) {
248
-
249
- t = ap + i - 1; /* 配列のアドレスの計算 */
250
-
251
- puts("変更しない場合は単に[return]を押して下さい");
252
-
253
- printf("番号: %s -> ", t->szNum);
254
-
255
- gets(buf);
256
-
257
- if (strlen(buf)) strcpy(t->szNum, buf);
258
-
259
- printf("氏名: %s -> ", t->szName);
260
-
261
- gets(buf);
262
-
263
- if (strlen(buf)) strcpy(t->szName, buf);
264
-
265
- printf("得点: %s -> ", t->szPoint);
266
-
267
- gets(buf);
268
-
269
- if (strlen(buf)) strcpy(t->szPoint, buf);
270
-
271
- }
272
-
273
- else
274
-
275
- puts("番号が不適切です");
276
-
277
- return cnt;
278
-
279
- }
280
-
281
- int del(Numress *ap, int cnt)
282
-
283
- {
284
-
285
- char buf[BUFSIZE];
286
-
287
- int i, j;
288
-
289
-
290
-
291
- puts("何番を削除しますか?");
292
-
293
- scanf("%d", &i); gets(buf);
294
-
295
-
296
-
297
- if (i > 0 && i <= cnt) {
298
-
299
- for (j = i - 1; j < cnt - 1; j++)
300
-
301
- ap[j] = ap[j + 1];
302
-
303
- return cnt - 1;
304
-
305
- }
306
-
307
-
308
-
309
- puts("番号が不適切です");
310
-
311
- return cnt;
312
-
313
- }
314
-
315
-
316
-
317
-
318
-
319
- int printall(Numress *ap, int cnt)
320
-
321
- {
322
-
323
- int i = 0;
324
-
325
-
326
-
327
- while (i < cnt) {
328
-
329
- printf("%d: 番号:%s 氏名:%s 得点:%s\n", ++i, ap->szNum, ap->szName, ap->szPoint);
330
-
331
- ap++;
332
-
333
- }
334
-
335
-
336
-
337
- return cnt;
338
-
339
- }

1

誤字

2016/03/19 18:34

投稿

Inabahitsuji
Inabahitsuji

スコア8

test CHANGED
File without changes
test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
-
23
+ ```C言語
24
24
 
25
25
  #include <stdio.h>
26
26
 
@@ -196,6 +196,8 @@
196
196
 
197
197
 
198
198
 
199
+ ```
200
+
199
201
  if (cnt == DATASIZE) {
200
202
 
201
203
  puts("これ以上追加できません");