質問編集履歴
1
プログラムに注釈を記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,6 +40,8 @@
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
+
//対戦カードの情報
|
44
|
+
|
43
45
|
struct match_score{
|
44
46
|
|
45
47
|
int year;
|
@@ -58,6 +60,8 @@
|
|
58
60
|
|
59
61
|
|
60
62
|
|
63
|
+
//対戦人とスコア
|
64
|
+
|
61
65
|
struct match{
|
62
66
|
|
63
67
|
char *home;
|
@@ -72,15 +76,27 @@
|
|
72
76
|
|
73
77
|
|
74
78
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
struct match *
|
82
|
-
|
83
|
-
|
79
|
+
//ハッシュ関数
|
80
|
+
|
81
|
+
int hash(char *home, char *away);
|
82
|
+
|
83
|
+
//match_scoreの連結リストを生成
|
84
|
+
|
85
|
+
struct match_score *make_match_score(int year, int month, int day, int home_score, int away_score, struct match_score *next);
|
86
|
+
|
87
|
+
//matchの連結リストを生成
|
88
|
+
|
89
|
+
struct match *make_match(char *home, char *away, struct match_score *r, struct match *next);
|
90
|
+
|
91
|
+
//2つのキーを持つmatchの連結リストの探索
|
92
|
+
|
93
|
+
struct match *find(char *home, char *away);
|
94
|
+
|
95
|
+
//ハッシュテーブルにmatchの連結リストを挿入
|
96
|
+
|
97
|
+
void add(int year, int month, int day, char *home, int home_score, int away_score, char *away);
|
98
|
+
|
99
|
+
|
84
100
|
|
85
101
|
|
86
102
|
|
@@ -126,6 +142,8 @@
|
|
126
142
|
|
127
143
|
|
128
144
|
|
145
|
+
//ハッシュ関数
|
146
|
+
|
129
147
|
int hash(char *home, char *away) {
|
130
148
|
|
131
149
|
int hashval = 0;
|
@@ -158,6 +176,8 @@
|
|
158
176
|
|
159
177
|
|
160
178
|
|
179
|
+
//match_scoreの連結リストを生成
|
180
|
+
|
161
181
|
struct match_score *make_match_score(int year, int month, int day, int home_score, int away_score, struct match_score *next) {
|
162
182
|
|
163
183
|
struct match_score *newmsp = malloc(sizeof(struct match));
|
@@ -184,6 +204,8 @@
|
|
184
204
|
|
185
205
|
|
186
206
|
|
207
|
+
//matchの連結リストを生成
|
208
|
+
|
187
209
|
struct match *make_match(char *home, char *away, struct match_score *r, struct match *next) {
|
188
210
|
|
189
211
|
struct match *newmp = malloc(sizeof(struct match));
|
@@ -210,6 +232,8 @@
|
|
210
232
|
|
211
233
|
|
212
234
|
|
235
|
+
//2つのキーを持つmatchの連結リストの探索
|
236
|
+
|
213
237
|
struct match *find(char *home, char *away) {
|
214
238
|
|
215
239
|
struct match *p;
|
@@ -236,6 +260,8 @@
|
|
236
260
|
|
237
261
|
|
238
262
|
|
263
|
+
//ハッシュテーブルにmatchの連結リストを挿入
|
264
|
+
|
239
265
|
void add(int year, int month, int day, char *home, int home_score, int away_score, char *away) {
|
240
266
|
|
241
267
|
struct match *newmp = NULL;
|