回答編集履歴
1
static を追加
answer
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
int calc_days(int year, int month, int day)
|
|
11
11
|
{
|
|
12
|
-
int monthdays[] = { 365,393,59,90,120,151,181,212,243,273,304,334 };
|
|
12
|
+
static int monthdays[] = { 365,393,59,90,120,151,181,212,243,273,304,334 };
|
|
13
13
|
if (month < 3) year--;
|
|
14
14
|
return year*365 + year/4 - year/100 + year/400
|
|
15
15
|
+ monthdays[month-1] + day - 366;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
int main(void)
|
|
19
19
|
{
|
|
20
20
|
int year, month, day;
|
|
21
|
-
int eachmonth[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
|
21
|
+
static int eachmonth[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
|
22
22
|
printf("記念日の西暦を入力してください: ");
|
|
23
23
|
scanf("%d", &year);
|
|
24
24
|
printf("記念日月を入力してください: ");
|