首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果为______。 #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
49
问题
下列程序的输出结果为______。
#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://kaotiyun.com/show/MnNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序#include<iostream>usingnamespacestd;classsample{private:intx;public:sample(inta){x=a;}frienddoublesq
下面程序的运行结果是【】。#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(){
C++程序设计语言是()。
软件危机出现于20世纪60年代末,为了解决软件危机,人们提出用【】的原理来设计软件,这就是软件工程诞生的基础。
随机试题
组织形象的基本特性主要有()
______hecanrecoversoon,Idon’tmindhowmuchmoneyIhavetopay.
轻度睡眠呼吸暂停综合征,其呼吸暂停指数范围是
庙底沟类型的彩陶艺术的代表作是()。
台历:墙壁
关于人民检察院对审判活动的监督,错误的是()。
简述情绪和情感的成分。
改革开放首先从农村开始,家庭联产承包责任制确定包产到户的原则,改变了()
Yougothereinordertoseeaplay.Youuseittokeeprainoffyourhead.
Completethetablebelow.WriteNOMORETHANTWOWORDSAND/ORANUMBERforeachanswer.
最新回复
(
0
)