質問編集履歴

1

起動から終了時までの問題点

2017/10/22 10:12

投稿

kakakaaka
kakakaaka

スコア17

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[10]; //学生番号
21
+ int num; //学生番号
20
22
 
21
23
  char name[10];//名前
22
24
 
23
- }
25
+ };
24
26
 
25
- struct student St[MAX]={{8,'Hanada'},
27
+ struct student St[MAX]={{8,"Hanada"},
26
28
 
27
- {5,'Goto'},
29
+ {5,"Goto"},
28
30
 
29
- {24,'Nishida'},
31
+ {24,"Nishida"},
30
32
 
31
- {10,'Toh'},
33
+ {10,"Toh"},
32
34
 
33
- {3,'Sasaki'}};
35
+ {3,"Sasaki"}};
34
36
 
35
- int Num = 5;
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.\n");
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
- exit status 1
101
+ ```