为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

switch分支结构

2019-08-27 5页 doc 16KB 9阅读

用户头像

is_003124

暂无简介

举报
switch分支结构Swtich分支结构 swtich 分支结构 一、选择题 1、执行下列语句后j等于() int i=2,j=2; switch(++i) { case 1: ++j; case 2: ++j; case 3: ++j default: ++j;} A、2 B、3 C、5 D、4 2、下列程序正确的是() int i=1,j=0; A、switch(i+j) B、switch(i+j); C、switch(i+j) D、switch(i+j) { case 1:i+=j; { case ...
switch分支结构
Swtich分支结构 swtich 分支结构 一、选择 1、执行下列语句后j等于() int i=2,j=2; switch(++i) { case 1: ++j; case 2: ++j; case 3: ++j default: ++j;} A、2 B、3 C、5 D、4 2、下列程序正确的是() int i=1,j=0; A、switch(i+j) B、switch(i+j); C、switch(i+j) D、switch(i+j) { case 1:i+=j; { case 1:i+=j; { case 1:i+=j; { case i:i+=j; case 2:i-=j;} case 2:i-=j;} case 1:i-=j;} case 2*i:i-=j;} 3、下列程序段()的功能是输入字符?Y?,回答“Yes”,输入字符?N?,回答“No” A、switch(getchar()) B、switch(getchar()); { case …Y?:printf(“Yes\n”); { case …Y?:printf(“Yes\n”); case …N?:printf(“No\n”);} case …N?:printf(“No\n”);} C、switch(getchar()) D、switch(getchar()); { case …Y?:printf(“Yes\n”); { case …Y?:printf(“Yes\n”); break; break; case …N?:printf(“No\n”); } case …N?:printf(“No\n”) 4、下述程序段中,正确的是() A、int x=0,y=10; B、int x=0,y; switch(x) switch(x) { case y:x++;break; { case x>0:y=1;break; case y+2:x+=10;break; case x==0:y=0;break; case y-1:x=-7;break; } case x<0:y=-1;break;} C、#define y 20 第 1 页共2 页 Swtich分支结构 int x=0,z; D、int x=0,y; switch(x) switch(x) { case 12:z=3;break; { case 3: case y+1:x+=10;break; case -1:y=2;break; case y-8:y-=3;break; } case 2: break;} 二、阅读程序题 1、当前整型变量i的值是10,执行下列switch语句后,i的值是_____________ switch(i) { case 9: i+=1; case 10: i+=1; case 11: i+=1; default: i+=1;} 2、输出结果____________ main() { int x=1,y=0,a=0,b=0; switch(x) { case 1:switch(y) { case 0: a++;break; case 1:b++;break;} case 2:a++;b++;break; case 3:a++;b++;} printf(“a=%d,b=%d”,a,b);} 3、程序结果为_______________ main() { int a=15,b=21,m=0; switch(a%3) { case 0: m++; break; case 1: m++; switch(b%3) { default :m++; break; case 0:m++;break;}} prinf(“%d”,m);} 第 2 页共2 页 继续阅读
/
本文档为【switch分支结构】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索