单项选择题

要求通过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);
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序#includestruct tt int x; struct tt *y; *p;struct tt a[4]=20, a+1,15,a+2,30,a+3,17,amain() int i;p=a;for(i=1; i<=2; i++) printf( %d , p->x); p=p->y;程序的运行结果是______。
A.20,30
B.30,17
C.15,30
D.20,15
单项选择题
若有定义:float x=1.5;int a=1,b=3,c=2;则正确的switch语句是______。
A.switch(x) case 1.0:printf("*\n");case 2.0:printf("**\n");
B.switch((int)x); case 1:printf("*\n");case 2:printf("**\n");
C.switch(a+b) case 1:printf("*\n");case 2+1:printf("**\n");
D.switch(a+b) case 1:printf("*\n");case c:printf("**\n");
相关试题
  • 有以下程序#include #include void fu...
  • 有以下程序int a=2;int f(int n) ...
  • 有以下程序#includevoid f(char p[]...
  • 有以下程序main() char *p[]= 3...
  • 有以程序#include #include typedef s...