質問編集履歴
1
起動から終了時までの問題点
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
```ここに言語を入力
|
2
2
|
|
3
|
-
|
3
|
+
起動はできているのですが、あてはまりません。
|
4
4
|
|
5
|
+
どこかおかしな点はありますか?
|
5
6
|
|
7
|
+
教えてください。
|
6
8
|
|
7
9
|
#include <stdio.h>
|
8
10
|
|
@@ -16,23 +18,23 @@
|
|
16
18
|
|
17
19
|
struct student{
|
18
20
|
|
19
|
-
int num
|
21
|
+
int num; //学生番号
|
20
22
|
|
21
23
|
char name[10];//名前
|
22
24
|
|
23
|
-
}
|
25
|
+
};
|
24
26
|
|
25
|
-
struct student St[MAX]={{8,
|
27
|
+
struct student St[MAX]={{8,"Hanada"},
|
26
28
|
|
27
|
-
{5,
|
29
|
+
{5,"Goto"},
|
28
30
|
|
29
|
-
{24,
|
31
|
+
{24,"Nishida"},
|
30
32
|
|
31
|
-
{10,
|
33
|
+
{10,"Toh"},
|
32
34
|
|
33
|
-
{3,
|
35
|
+
{3,"Sasaki"}};
|
34
36
|
|
35
|
-
|
37
|
+
|
36
38
|
|
37
39
|
int main(){
|
38
40
|
|
@@ -44,7 +46,7 @@
|
|
44
46
|
|
45
47
|
while(1){
|
46
48
|
|
47
|
-
printf("Please input a key
|
49
|
+
printf("Please input a key:");
|
48
50
|
|
49
51
|
if(scanf("%d", &tgt_key)==EOF)
|
50
52
|
|
@@ -94,58 +96,6 @@
|
|
94
96
|
|
95
97
|
}
|
96
98
|
|
97
|
-
<code>
|
98
|
-
|
99
|
-
main.c:10:1: error: expected ';', identifier or '(' before 'struct'
|
100
|
-
|
101
|
-
struct student St[MAX]={{8,'Hanada'},
|
102
|
-
|
103
|
-
^~~~~~
|
104
|
-
|
105
|
-
main.c:10:28: warning: character constant too long for its type
|
106
|
-
|
107
|
-
struct student St[MAX]={{8,'Hanada'},
|
108
|
-
|
109
|
-
^~~~~~~~
|
110
|
-
|
111
|
-
main.c:11:28: warning: multi-character character constant [-Wmultichar]
|
112
|
-
|
113
|
-
{5,'Goto'},
|
114
|
-
|
115
|
-
^~~~~~
|
116
|
-
|
117
|
-
main.c:12:29: warning: character constant too long for its type
|
118
|
-
|
119
|
-
{24,'Nishida'},
|
120
|
-
|
121
|
-
^~~~~~~~~
|
122
|
-
|
123
|
-
main.c:13:29: warning: multi-character character constant [-Wmultichar]
|
124
|
-
|
125
|
-
{10,'Toh'},
|
126
|
-
|
127
|
-
^~~~~
|
128
|
-
|
129
|
-
main.c:14:28: warning: character constant too long for its type
|
130
|
-
|
131
|
-
{3,'Sasaki'}};
|
132
|
-
|
133
|
-
^~~~~~~~
|
134
|
-
|
135
|
-
main.c: In function 'search':
|
136
|
-
|
137
|
-
main.c:37:14: warning: comparison between pointer and integer
|
138
|
-
|
139
|
-
if(target==St[mid].num)
|
140
|
-
|
141
|
-
^~
|
142
|
-
|
143
|
-
main.c:39:19: warning: comparison between pointer and integer
|
144
|
-
|
145
|
-
else if(target<St[mid].num)
|
146
|
-
|
147
|
-
^
|
148
99
|
|
149
100
|
|
150
|
-
|
151
|
-
|
101
|
+
```
|