首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序的输出结果是( )。 #include <iostream> using namespace std; int main(){ int a=1,b; switch(a){
以下程序的输出结果是( )。 #include <iostream> using namespace std; int main(){ int a=1,b; switch(a){
admin
2013-02-27
7
问题
以下程序的输出结果是( )。 #include <iostream> using namespace std; int main(){ int a=1,b; switch(a){ case 1:b=30; case 2:b=20; case 3:b=10; default:b=0; } cout<<b<<endl; return 0; }
选项
A、30
B、20
C、10
D、0
答案
8
解析
由于在case分支的语句后没有出现跳转语句,所以程序将一直执行到switch语句结束。即逐步给变量b赋值30、20、10和0,最后b的值为0。
转载请注明原文地址:https://kaotiyun.com/show/ybNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
写出下列程序的运行结果【】。#include<iostream.h>.#include<fstream.h>#include<stdlib.h>voidmain(){fstreamoutfile,infile;outfile.
数据处理的最小单位是()。
下列不属于3种基本控制结构是()。
C++语言本身没有定义I/O操作,使用I/O流的程序需要包括()。
下列程序的输出结果为Objectid=0Objectid=1请将程序补充完整。#include<iostream>usingnamespacestd;classPoint{public:Point(intxx=0,in
当循环队列非空且队尾指针等于队头指针时,说明循环队列已满,不能进行人队运算。这种情况称为【】。
以下数据结构中不属于线性数据结构的是()。
对长度为n的线性表进行顺序查找,在最坏情况下所需要的比较次数为()。
使用setw()这样的操作符对数据进行格式输出时,应包含头文件()。
下列选项中属于C++语句的是()。
随机试题
A.Aα类纤维B.Aβ类纤维C.Aδ类纤维D.C类纤维传导快痛的神经纤维是
建设工程项目监理机构的组织形式和规模,应根据委托监理合同规定的( )。
( )只传递扭矩而不承受弯矩或弯矩很小。
上市公司()的,中国证监会可能核准其新股发行申请。
某研究所在装运存有放射性物质的铅箱时,一只箱子从车上掉下来,王某(8岁)看见后,即取出箱中的放射性物质玩耍,结果因过量吸收放射性物质而得病。问:王某的治疗费和其他必要费用应由( )。
某企业2013年经主管税务机关核准,按上年应纳税额季度平均数,每季预缴15元,次年进行所得税汇算清缴时确定全年应纳税所得额为300万元,请编写企业当年预缴及次年汇算清缴时的会计分录。
甲公司是增值税税率为17%的一般纳税企业,2011年9月10日甲公司向乙公司销售一批商品,不含税售价为20000元,因属于批量销售,甲公司同意给乙公司10%的商业折扣;同时为了鼓励乙公司及早还款,甲公司规定的现金折扣条件是(按含增值税的售价计算)为:2/
以下与“书山有路勤为径,学海无涯苦作舟”判断不同的是()。
下列关于公民和组织维护国家安全义务的表述,不符合《国家安全法》规定的是()。
Mary,the(old)______ofthethreesisters,runsatravelagencyinNewYork.
最新回复
(
0
)