有以下程序
#include<stdio.h>
main( )
{int a=1,b=0
if(!a)b++;
else if(a==0)if(a)b+=2
else b+=3
printf(”%d\n”,b);
}
程序运行后的输出结果是( )。
A.0
B.1
C.2
D.3
第1题:
【单选题】以下程序的运行后的输出结果是_______。 #inlude <stdio.h> main() { int a=1,b=0; if(--a) b++; else if(a==0) b+=2; else b+=3; printf("%dn",b); }
A.0
B.1
C.2
D.3
第2题:
试题18
有以下程序
#include <stdio.h>
main()
{ int a=1,b=0;
if(- -a) b++;
else if(a= =0) b+=2;
else b==3;
printf(“%d\n”, b);
}
程序运行后的输出结果是()
A.0
B.1
C.2
D.3
第3题:
若有如下程序: main() { int a=1,b=1; for(;a<=10;a++) { if(b>=9) break; if(b%3==1) {b+=3;continue;} b++; } printf("%d,%d",b,a); } 则程序运行后的输出结果是( )。
A.10,4
B.7,3
C.10,3
D.11,3
第4题:
有以下程序
#include<stdio.h>
main()
{ int a=1,b=0;
if(--a)b++;
else if(a==0) b+=2;
else b+=3:
printf("%d\n",b);
}
程序运行后的输出结果是
A.0
B.1
C.2
D.3
第5题:
有以下程序 #include <stdio.h> main() { int x=1,y=0,a=0,b=0; switch(X) { case 1: switch(y) { case 0:a++; break; case 1:b++; break; } case 2:a++;b++;break; case 3:a++;b++; } printf("a=%d,b=%d\n",a,b); } 程序
A.a=1,b=0
B.a=2,b=2
C.a=1,b=1
D.a=2,b=1
第6题:
有以下程序:
#include<stdio.h>
main( )
{ int a=1,b=0;
if(--a)b++;
else if(a==0)b+=2;
else b+=3:
print[("%d\n",b);
}
程序运行后的输出结果是( )。
A.0
B.1
C.2
D.3
第7题:
有以下程序 #include <stdio.h> main() { int x=1,y=0,a=0,b=0; switch(x) { case 1: switch(y) { case 0:a++; break; case 1:b++; break; } case 2:a++;b++; break; case 3:a++;b++; } printf("a=%d,b=%d\n",a,b); } 程序的运行结果是
A.a=1,b=0
B.a=2,b=2
C.a=1,b=1
D.a=2,b=1
第8题:
有以下程序: #include<stdio.h> main() { int x=1,y=0,a=0,b=0; switch(x) { case 1: switch(y) { case 0:a++;break; case 1: b++;break; } case 2:a++;b++;break; case 3:a++;b++; } printf("a=%d,b=%d\n",a,B); } 程序的运行结果是( )。
A.a=1,b=0
B.a=2,b=2
C.a=1,b=1
D.a=2,b=1
第9题:
下列程序的输出结果是( )。 #include<stdio.h> int b=2; int func(int*A){ b+=*a;return b;} main() { int a=1,t=2; t+=func(&a); printf("%d\n",t); }
A.4
B.5
C.6
D.8