单项选择题

要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()。

A.while((ch=getchar())! ='N') printf("%c",c;
B.while (ch=getchar()! ='N') printf("%c",c;
C.while (ch=getchar()='N') printf("%c",c;
D.while((ch=getchan())='N') printf("%c",c;

<上一题 目录 下一题>
热门 试题

单项选择题
若各选项中所有变量已正确定义,函数fun中通过return语句返回一个函数值,以下选项中错误的程序是()。

A.mam() {…… x=fun(2,10); ……} fioat fun(int a,int { ……}
B.float fun (int a,int {……} main() {…… x=fun(i,; ……}
C.float fun (int in; main() {…… x=fun(2,10); ……} float fun (int a,int { ……}
D.main() { float fun (int i, int ; …… x=fun(i,; ……} float fun (int a,int { ……}

单项选择题
若有定义:float x=1.5;int a=1,b=3,c=2;则正确的switch语句是()。

A.switch ( {case 1.0: printf("*\n"); case 2.0: printf("**\n");}
B.switch ( (in; {case 1: printf("*\n"); case2: printf("**\n");}
C.switch (a+ {case 1:printf("*\n"); case 2+1: printf("**\n");}
D.switch (a+) {case 1: pfintf("*\n")}; case c: printf("**\n"));}

相关试题
  • 执行以下程序后,test.txt文件的内容是(...
  • 有以下程序 void fun 1 (char *p)...
  • 有以下程序 #include <stdio.h> mai...
  • 有以下程序 main() {int i,j,x=0...
  • 有以下程序 int fun(int x[],int n...