帮忙解释下下面程序的意思吧,谢谢主要是x % 4 == 0 && x % 100 = 0 || x % 400 == 0
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/04 20:49:21
帮忙解释下下面程序的意思吧,谢谢主要是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("%d\n",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;
}
#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("%d\n",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;
}
(x % 4 == 0 && x % 100 != 0 || x % 400 == 0)意思是能同时被
4,100,400整除 “%”是取余数的意思
4,100,400整除 “%”是取余数的意思
int x=10; x-=x+=x+2; x的值为什么等于0? 请各位帮忙详解,主要是计算的过程. 谢谢!
帮忙解释下下面几句c语言的意思,fp=fopen("test.dat","wb"); fwrite(x,si...
请问下下列程序运行的结果是什么? store 0 to x,y x=5 y=6 x=x+y y=x-y x=x-y ?x
请在下面写出解一元二次方程 x^2-x-12=0的程序
帮忙检查一下c语言的程序错在哪里,题目是求解一元二次方程.a*x*x+b*x+c=0
编写程序,计算下列分段函数的值.x (x>=0) y= -x (x
函数y=2-根号下4x-x平方(x∈【0,4】)的值域是谢谢了,大神帮忙啊
8X的平方-8X+1=0的解谢谢了,大神帮忙啊
VB执行下列程序: X = 0 Do While X
用C语言编写程序,用牛顿迭代法求高次方程f(x)=5*x*x*x*x*x-8*x*x*x+10*x*x-7x+25=0的
下面程序表示的函数解析式是,if x>0,then y=2^x+1,else y=x*x+2*x,end if,prin
matlab 编写程序计算f(x)=x>0,x^3+5;x