首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果为______。 #include<iostream.h> void Func(char ch) { switch(ch) { case ’A’:case ’a’:
下列程序的输出结果为______。 #include<iostream.h> void Func(char ch) { switch(ch) { case ’A’:case ’a’:
admin
2013-05-30
22
问题
下列程序的输出结果为______。
#include<iostream.h>
void Func(char ch)
{
switch(ch)
{
case ’A’:case ’a’:
cout<<"优秀"<<endl;
case ’B’:case ’b’:
cout<<"良好"<<endl;
break;
case ’C’:case ’c’:
cout<<"及格"<<endl;
break;
default:
cout<<"不及格"<<endl;
}
}
void main( )
{
char ch1=’b’
Func(ch1);
Func(’A’);
}
选项
答案
良好 优秀 良好
解析
本题主要考察switch语句中break语句的使用。由于case A和 case B之间没有break语句,导致在输出“优秀”之后顺序执行并输出了 “良好”,这与原来的设计思路是不符的。
转载请注明原文地址:https://jikaoti.com/ti/1bE0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下类定义;classAA{inta;public:intgetRef()const{return&a;}//①intgetValue()const{returna;}//②voidset(intn)const{a=n
下列程序的运行结果是()。#include<iostream.h>voidfun(int*a,int*b) {int*k;k=a;a=b;b=k;}voidmain(){inta=2OO4,b=9,*x=&a,*y=&b;fu
下列语句段落将输出字符’*’的个数为()。#include<iostream.h>Voidmain(){inti=100;while(1){i--;if(i==0)break;cout<<’*’;}}
模块化程序设计过程中,追求模块的独立性,尽量做到()。
下面程序的运行结果是【】。#include<iostream.h>doublefun(doublea,doubleb,charc=’*’){doubled;switch(c){case’+’:d=a+b;bre
下面程序的输出结果为【】。#include<iostream.h>f(inta){intb=0;staticintc=3;b++;c++;return(a+b+c);}voidmain(){inta=2,i;
设有定义语句:inta=12;,则表达式a*=2+3的运算结果是【】。
下列程序写法不正确的是()。
有如下程序:#include<iostream>usingnamespacestd;intfun(inta,intb){return(++a*b++);}voidmain(){
随机试题
Peopletodayarestilltalkingaboutthegenerationgap(代沟).Someparentscomplainthattheirchildrendonotshowthemproperr
《拆迁管理条例》规定,拆迁人与被拆迁人应当依照本条例的规定,就补偿安置、搬迁期限等事项签订拆迁补偿安置协议。拆迁人应当在拆迁补偿安置协议订立之日起()日内到房屋拆迁主管部门办理备案手续。
由银行作为出票人签发,银行在见票时按照实际结算金额无条件支付给收款人或者持票人的票据是()。
按照惯例,北华工商管理学院每年一度的特等奖学金获得者的名额仅3名,奖金数额高达10000元。1998年,该校董事会关于评定本年度特等奖学金确定了如下的原则:只有连续3年获得过三等奖以上的奖学金并且本年度各门学科终考成绩平均得分在90分以上的,方可获该项特等
宋之鄙人得璞玉献之子罕,子罕不受。鄙人曰:“此宝也,宜为君子器,不宜为细人用。”子罕曰:“尔以玉为宝,我以不受子之玉为宝。”上述材料说明()。
学生害怕在社交场合讲话,担心自己会因发抖,脸红,声音发颤,口吃而暴露自己的焦虑,觉得自己说话不自然,因而不敢抬头,不敢正视对方眼睛,这种心理状态是一种()。
政府进行需求管理的政策工具主要是()。
在一个口袋中有10个黑球、6个白球、4个红球,至少从中取出多少个球才能保证其中有白球?
实际上雾霾形成的原因是多方面的,识别污染源是有效治理大气污染至关重要的环节。对京津冀区域而言,认清区域内污染源的共性及差别,有助于区域内地区_________地对污染源进行综合治理。填入画横线部分最恰当的一项是:
某学校初中二年级五班的物理老师要求学生两人一组制作一份物理课件。小曾与小张自愿组合,他们制作完成的第一章后三节内容见文档“第3-5节.pptx”,前两节内容存放在文档“第1-2节.pptx”中。小张需要按下列要求完成课件的整合制作:将演示文稿“第3-5
最新回复
(
0
)