等级为A,score=100;等级为B,score=190;等级为C或D,score=60;其他,score=0.if语句,以下正确的是 ( )。
A. a) if(grade='A') score=100; else if(grade='B') score=90; else if(grade='C'||grade='D') score=60; else score=0;
B. b) if(grade=='A') score=100; if(grade=='B') score=90; if(grade=='C'||grade=='D') score=60; else score=0;
C. c) if(grade=='A') score=100; else if(grade=='B') score=90; else if(grade=='C') score=60; else if(grade=='D') score=60; else score=0;
D. d) if(grade=='A') score=100; else if(grade=='B') score=90; else if(grade=='C'&&grade=='D') score=60; else score=0;
查看答案
给定某C程序片断,如下:int i = 1;int j = i++;if((i > ++j) && (i++ == j))i += j;printf(i);该程序运行后,i的输出结果是( )。
A. a) 1
B. b) 2
C. c) 3
D. d) 4
以下能表示a和b同时为正或同时为负的逻辑表达式是()。
A)(a>=0||b>=0)&&(a<0||b<0)
B)a>=0&&b>=0)&&(a<0&&b<0)
C)(a+b>0)&&(a+b<=0)
D)a*b>0
有如下程序main(){floatx=4.0,y;if(x<0.0)y=0.0;elseif(x<10.0)y=1.0/x;elsey=1.0;printf(“%f\n”,y);}该程序的输出结果是()
A)0.0
B)0.25
C)0.5
D)1.0
下列程序段运行后,x的值是()。inta,b,c,x;a=b=c=0;x=35;if(!a)x--;elseif(b);if(c)x=3;elsex=4;
A)3
B)4
C)34
D)35