include <stdio.h>
main( )
{ int a=-2, b=2;
for(; ++a && –b;)
printf(“%d,%d,”, a,b);
}
程序执行后的输出结果是()。
A:-1,1,
B:0,1,
C:-1,1,0,0,
D:-1,1,0,1,
正确答案:【-1,1,】
3、单选题:要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是( )
A:while(ch=getchar() =’N’) printf(“%c “,ch);
B:while(ch=getchar()==’N’) printf(“%c “,ch);
C:while((ch=getchar())!=’N’) printf(“%c “,ch);
D:while((ch=getchar())==’N’) printf(“%c “,ch);
正确答案:【while((ch=getchar())!=’N’) printf(“%c “,ch);】
4、单选题:有以下程序
|