单项选择题

若定义:float x;int a,b;,则正确的switch语句是( )。

A.switch(x)
B.switch(x) case1.0:cout<<"*\n"; case 1.2:cout<<"*\n"; case2.0:cout<<"**\n"; case 3:cout<<"**\n"; C. switch(a+b) D. switch(a+b) case 1.0:cout<<"*\n"; case 1:cout<<"*\n"; case 1+2:cout<<"**\n "; case 2:cout<<"**\n";
<上一题 目录 下一题>
热门 试题

单项选择题
有如下类声明: class MyBASE int k; public: void set(int n) k=n; int get()constreturn k; ; class MyDERIVED:protected MyBASE protected. int j; public: void set(int m,int n)MyBASE::set(m);j=n; int get()constreturn MyBASE::get()+j; ; 则类MyDERIVED中保护的数据成员和成员函数的个数是( )。
A.4
B.3
C.2
D.1
单项选择题
有如下类定义: class MyBase int k; public: MyBase(int n--0):k(n) int value()constreturn k; ; class MyDefived: MyBase int j; public: MyDefived(int i):j(i) int getK()constreturn k; int getJ()constreturn j; ; 编译时发现有一处语法错误,对这个错误最准确的描述是( )。
A.函数getK试图访问基类的私有成员变量k
B.在类MyDerived的定义中,基类名MyBase前缺少关键字public、protected或pfivate
C.类MyDerived缺少一个无参的构造函数
D.类MyDerived的构造函数没有对基类数据成员k进行初始化
相关试题
  • 带有 【14】 的类称为抽象类,它只能作...
  • 有以下面程序: #include <iostream>...
  • 若有以下定义及初始化语句: int i=10...
  • 有如下程序: #include <iostream> u...
  • 设有下定义的语句: int a[3][2]=...