若定义float x;int a,b,则正确的switch语句是:
A. switch(x) {case 1.0:printf("*\n");case 2.0:printf("**\n"); }
B. switch(x) {case 1.2:printf("*\n"); case 3:printf("**\n"); }
C. switch(a+b) {case 1:printf"*\n"};case 1+2:printf("**\n") }
D. switch(a+b) {case 1:printf("*\n");case 2:printf("**\n"); }
查看答案
执行下列程序,输入为1的运行结果是:#include int main(){int k;scanf("%d",&k);switch(k){case 1:printf("%d ",k++);break;case 2: printf("%d ",k++);case 3: printf("%d ",k++);break;case 4: printf("%d ",k++);default:printf("Full!\n");}return 0;}
A. 1
B. 2
C. 2 3 4 5
D. 1 2 3 4
执行下列程序,输入为3的运行结果是:#include int main(){int k;scanf("%d",&k);switch(k){case 1:printf("%d ",k++);break;case 2: printf("%d ",k++);case 3: printf("%d ",k++);break;case 4: printf("%d ",k++);default:printf("Full!\n");}return 0;}
A. 3
B. 4
C. 3 4
D. 4 5
执行下列程序,输入为1的运行结果是:#include int main(){int k;scanf("%d",&k);switch(k){case 1: printf("%d ",k++);case 2: printf("%d ",k++);case 3: printf("%d ",k++);case 4: printf("%d ",k++);break;default:printf("Full!\n");}return 0;}
A. 1
B. 2
C. 2 3 4 5
D. 1 2 3 4
执行下列程序,输入为3的运行结果是:#include int main(){int k;scanf("%d",&k);switch(k){case 1: printf("%d ",k++);case 2: printf("%d ",k++);case 3: printf("%d ",k++);case 4: printf("%d ",k++);break;default:printf("Full!\n");}return 0;}
A. 3
B. 4
C. 3 4
D. 4 5