题目内容

下列语句正确的是( )

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

有如下程序#includevoid main(){float x=2.0,y;if(x < 0.0)y=0.0;else if(x < 10.0)y=1.0/x;elsey=1.0;printf("%f\n",y);}该程序的输出结果是

A. 0.000000
B. 0.250000
C. 0.500000
D. 1.000000

答案查题题库