题目内容

判断两个字符串S1 和 S2 相等的正确语句是____

A. if (S1=S2)
B. if (S1==S2)
C. if (strcpy(S1,S2))
D. if (strcmp(S1,S2)==0)

查看答案
更多问题

下列语句正确的是( )

A. if(a > b > c) temp=a
B. if((a=b) > 0) temp=a;
C. int a=b=c=4
D. int a;scanf(%d,a)

与 y=(x > 0?1:x < 0?-1:0);的功能相同的if语句是

A. if(x > 0) y=1; else if(x < 0) y=-1; else y=0;
B. if(x)if(x > 0) y=1;else if(x < 0) y=-1;else y=0;
C. y=-1 if(x) y=1; else if(x==0) y=0; else y=-1;
D. y=0 if(x > -0) if(x > 0) y=1; else y=-1;

若有定义: float w; int a, b; 则合法的switch语句是

A. switch(w){case1.0: printf("*\n"); case2.0: printf("**\n"); }
B. switch(a); { case 1 printf("*\n"); case 2 printf("**\n");}
C. switch(b) { case a: printf("*\n"); default: printf("\n"); case b: printf("**\n");}
D. switch(a+b){ case 1: printf("*\n"); case 2: printf("**\n"); default: printf("\n"); }

有如下程序#includevoid main(){int x=1,a=0,b=0;switch(x){case 0: b++;case 1: a++;case 2: a++;b++;}printf("a=%d,b=%d\n",a,b);}该程序的输出结果是

A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2

答案查题题库