单选题
C++
题号 #2251319
有下列程序:
#include<stdi0.h>
voidmain( )
{inta=1,b=2,c=3,d=0;
if(a==1&&b++==2)
if(b!=2‖c--!=3)
printf("%d,%d,%d\n",a,b,c);
elseprintf("%d,%d,%d\n",a,b,c);
elseprintf("%d,%d,%d,%d\n",a,b,c);
}
程序运行后的输出结果是( )。
参考答案
C
答案解析
C。【解析】在程序中,当执行第一条if语句时,进行逻辑语句的判断,因为变量b的初值为2,所以其值加1后为3,与2不相等,所以if语句中的逻辑表达式的值为假,则程序执行最后一条elseprintf语句。输出变量为a,b,c,当前数值为1,3,3。所以正确答案为选项C。
你可能感兴趣的试题
A.********
B.****
C.**
D.*
A.5670
B.656667
C.567
D.ABC
A.n=0;while((ch=getchar( ))!='\n')n++;
B.n=0;while(getchar( )!='\n')n++;
C.for(n=0;getchar( )!='\n';n++);
D.n=0;for(ch=getchar( );ch!='n';n++);