我正在学习C。我遇到错误消息“||令牌之前的预期表达式”。
#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;
}
}