2
我正在學習C的過程中。我遇到了一個錯誤消息「在|| token之前的預期表達式」。'||'之前的預期表達式令牌
#include <stdio.h>
char calculate_Easter_date(int y);
int main()
{
int year;
char sol [80];
while (1)
{
scanf("%d", &year);
if (year == EOF){
break;
}
sol = calculate_Easter_date(year);
printf("%s\n", sol);
}
return 0;
}
char calculate_Easter_date(int y)
{
char buf[80];
int g = (y % 19) + 1;
int c = (y/100) + 1;
int x = (3 * c/4) - 12;
int z = ((8 * c + 5)/25) - 5;
int d = (5 * y/4) - x - 10;
int e = (11 * g + 20 + z - x) % 30;
if ((e == 25) && (g > 11)) || (e == 24){
e ++;
}
int n = 44 - e;
if (n < 21){
n += 30;
}
int n = (n + 7) - ((d + n) mod 7);
if (n > 31){
sprintf(buf, "%d APRIL %d", y, n - 31);
return buf;
}
else{
sprintf(buf, "%d MARCH %d", y, n);
return buf;
}
}
你在calculate_Easter_date()的第8行有一個太多的圓括號, – Joel