习题1:
/* 从键盘上出入5,则输出是
A 7 B 6 C 5 D 4
*/
#include <stdio.h>
void main(){
int x;
scanf("%d",&x);
if(x++>5)
printf("%d\n",x);
else
printf("%d\n",x--);
}
习题2:
/* A、a=2,b=1 B、a=1,b=1
C、a=1,b=0 D、a=2,b=2
*/
#include <stdio.h>
void 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);
}
习题3:
/* A、0.000000 B、0.250000
C、0.500000 D、1.000000
*/
#include <stdio.h>
void main(){
float x=2.0,y;
if(x<0.0)
y=0.0;
else if(x<10.0)