#includevoid main(){int x,y;x=2,y=2;if(x==1)if(x==2)printf("
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/12 00:52:18
#include
void main()
{
int x,y;
x=2,y=2;
if(x==1)
if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
printf("x=%d\n",x);
}
void main()
{
int x,y;
x=2,y=2;
if(x==1)
if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
printf("x=%d\n",x);
}
因为 else会和离他最近的一个if配对,那么程序就成这样了~!
#include
void main()
{
int x,y;
x=2,y=2;
if(x==1)
{if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
}
printf("x=%d\n",x);
}
所以是不执行你认为要执行的if(x==2)的
如果想要他执行,可以这样写:
#include
void main()
{
int x,y;
x=2,y=2;
if(x==1);
if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
printf("x=%d\n",x);
}
#include
void main()
{
int x,y;
x=2,y=2;
if(x==1)
{if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
}
printf("x=%d\n",x);
}
所以是不执行你认为要执行的if(x==2)的
如果想要他执行,可以这样写:
#include
void main()
{
int x,y;
x=2,y=2;
if(x==1);
if(x==2)
printf("x=%d\n",x=x+y);
else
printf("x=%d\n",x=x-y);
printf("x=%d\n",x);
}
#include main() { int x=3,y; do { y=x--; if(!y) {printf("*")
#includevoid f(int y,int *x){ y=y+*x; *x=*x+y;} void main(){
c语言的问题#includevoid main(){ int x,y; scanf("%d",x); if(x>2) i
int x=1;if(x=2) printf("you are a good boy"); else printf("y
#include void main() { int x=0,y=1,z=2; if(!x) z=-1; if (y)
void main() {int x=4;if(x++>=5)printf("%d/n",x);else printf(
#include "stdio.h"void main(){int x=3,y=5; if (x=y-4) printf
c语言 { int x=1,y=1; if(0)if(1)x=2;else y=3; printf("x=%d,y=%d
main() { int x=10; int y=x++; printf("%d,%d\n",(x++,y),y++);
#includemain(){int x=1,y=2,z=3;if(x>y)if(y
、 #define M(x,y,z) x*y+z main() { int a=1,b=2,c=3; printf("%
#include main() { int x=2,y=3; x%=y+3; printf("%d",x); } 谁能给