teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

低評価+ベテランの人が正しいであろう回答を送っていたため

2020/07/23 19:45

投稿

bboydaisuke
bboydaisuke

スコア5339

answer CHANGED
@@ -1,45 +1,1 @@
1
- ```c
2
- #include <stdio.h>
3
- #include <string.h>
4
-
5
- struct PLAYER {
6
- int num;
7
- char name[20];
8
- char position[3];
9
- double height;
10
- };
11
-
12
- struct PLAYER p[6] = { {10,"Messi","FW",170},
13
- {20,"Neto","GK",180},
14
- {30,"Tenas","GK",185},
15
- {40,"Semedo","MF",175},
16
- {50,"Tenas","DF",187},
17
- {60,"Roberto","DF",182} };
18
-
19
- int main() {
20
- char buf[20];
21
- int count = 0;
22
-
23
- printf("選手の名前>");
24
- scanf("%s", buf);
25
-
26
- if (strcmp(buf, "leave") != 0)
27
- {
28
- for (int i = 0; i < sizeof(p) / sizeof(struct PLAYER); i++)
29
- {
30
- if (strcmp(p[i].name, buf) == 0)
31
- {
32
- printf("%d %s %.lfcm\n", p[i].num, p[i].position, p[i].height);
33
- count++;
34
- }
35
- }
36
-
37
- if (count == 0)
38
- {
39
- printf("No match");
40
- }
41
- }
42
-
43
- return 0;
1
+ 削除リクエスト済み。
44
- }
45
- ```