#include<stdio.h>#include<stdlib.h>gys(int u,int v);gbs(int m,int n);sxhs(); rnpd(int y);sssy(int n);jzxj(); yhsj();sjpx(int a[]);void main(){int y,i,m,u,v,s[10],gy,gb,n,k,sxh,jz,ss,yh;以下省略case 4:printf("輸入一個年份: ");scanf("%d",&y);rnpd(y);break;rnpd(y){int leap;if(y%4==0){if(y%100==0){if(y%400==0)leap=1;elseleap=0;} elseleap=1;}elseleap=0;if(leap)printf("is a leap year\n");elseprintf("is not a leap year\n");}y已經(jīng)聲明了,為什么電腦仍然說:546.cpp(144) : error C2065: 'y' : undeclared identifier
2 回答

陪伴而非守候
TA貢獻(xiàn)1757條經(jīng)驗 獲得超8個贊
rnpd(int y) //這里忽略參數(shù)類型了。
{int leap;
if(y%4==0)
{
if(y%100==0)
{
if(y%400==0)
leap=1;
else
leap=0;
}
else
leap=1;
}
else
leap=0;
if(leap)
printf("is a leap year\n");
else
printf("is not a leap year\n");
}
- 2 回答
- 0 關(guān)注
- 180 瀏覽
添加回答
舉報
0/150
提交
取消