帮忙解释下下面程序的意思吧,谢谢主要是x % 4 == 0 && x % 100 = 0 || x % 400 == 0

帮忙解释下下面程序的意思吧,谢谢主要是x % 4 == 0 && x % 100 = 0 || x % 400 == 0的意思.
#include
void main( )
{ int s,x1,y1,z1,x2,y2,z2;
printf("Enter 6 integers:");
scanf("%d%d%d%d%d%d",&x1,&y1,&z1,&x2,&y2,&z2);
s = f(x2,y2,z2) - f(x1,y1,z1);
printf("%dn",s);
}
f(int x,int y,int z)
{ int k,n;
int tab[2][13] = {
{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}
};
n = (x % 4 == 0 && x % 100 = 0 || x % 400 == 0);
for(k = 1; k < y; k++)
z = z + tab[n][k];
return z;
}
添加一个问题,麻烦啦
void main ( )
{ int a = -1,b = 1;
void f1(int x,int y),f2(int *x,int *y);
void f3(int *x,int *y),f4(int x,int y);
f1(a,b);
printf("(%d,%d)n",a,b);
a = -1,b = 1;
f2(&a,&b);
printf("(%d,%d)n",a,b);
a = -1,b = 1;
f3(&a,&b);
printf("(%d,%d)n",a,b);
a = -1,b = 1;
f4(a,b);
printf("(%d,%d)n",a,b);
}
void f1(int x,int y)
{ int t;
t = x; x = y; y = t;
}
void f2(int *x,int *y)
{ int t;
t = *x; *x = *y; *y = t;
}
void f3(int *x,int *y)
{ int *t;
t = x; x = y; y = t;
}
void f4(int x,int y)
{ int *t = malloc(sizeof(t));
*t = x; x = y; y = *t;
}
dxlw4u 1年前 已收到1个回答 举报

changjuhong 春芽

共回答了21个问题采纳率:95.2% 举报

(x % 4 == 0 && x % 100 != 0 || x % 400 == 0)意思是能同时被
4,100,400整除 “%”是取余数的意思

1年前

10
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.024 s. - webmaster@yulucn.com