首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class Monitor{ public: Monitor(char t):type(t){} void Print()const {cout
有如下程序: #include using namespace std; class Monitor{ public: Monitor(char t):type(t){} void Print()const {cout
admin
2010-03-15
19
问题
有如下程序:
#include
using namespace std;
class Monitor{
public:
Monitor(char t):type(t){}
void Print()const
{cout<<”The type of monito~is”<<.type《
private:
char.type;
};
class Computer{
public:
Computer(int i,charC):【 】{}
void Print()const
{cout<<”The computer is”<
private:
int id;
Monitot moil;
};
int main(){
const Computer myComputer(101,B);、
myComputer.Print();
return 0;
}
请将程序补充完整,使程序在运行时输出:
The computer is 101
The type of monitor is B
选项
答案
mOB(c),id(i)
解析
要填写的是Computer-类的构造函数。该构造函数使用成员列表初始化。
转载请注明原文地址:https://kaotiyun.com/show/mbjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序段:charstr[4][12]={"aaa","bbb","ccc","ddd"},*p[4];inti;for(i=0;i<4;i++)p[i]=str[i];以下选项中不能正确引用字符串的是()。
设有定义:intx=0,*p;紧接着的赋值语句正确的是()。
有三个关系R、S和T如下:由关系R和S通过运算得到关系T,则所使用的运算为( )。
程序中已构成如下图所示的不带头结点的单向链表结构,指针变量s、p、q均已正确定义,并用于指向链表结点,指针变量s总是作为指针指向链表的第一个结点。若有以下程序段:q=s;s=s->next;p=s;while(p->next)p=p->next:p
下列选项中,不能作为合法常量的是()。
下列关于类、对象、属性和方法的叙述中,错误的是()。
在关系A(S,SN,D)和B(D,CN,NM)中,A的主关键字是S,B的主关键字是D,则D是A的()。
在关系数据库中,描述全局数据逻辑结构的是
设有表示学生选课的三张表,学生S(学号,姓名,性别,年龄,身份证号),课程C(课号,课名),选课SC(学号,课号,成绩),则表SC的关键字(键或码)为()。
程序通过定义学生结构体变量,存储了学生的学号、姓名和3门课的成绩。所有学生数据均以二进制方式输出到文件中。函数fun的功能是重写形参filename所指文件中最后一个学生的数据,即用新的学生数据覆盖该学生原来的数据,其他学生的数据不变。请在程序的
随机试题
注意噪声控制的范围依据《环境噪声污染防治法》判断下列说法正确的是()
王某从某大学房地产专业毕业后进入甲房地产经纪公司(以下简称甲公司)从事房屋销售。凭上大学四年所学的专业知识,王某的销售业绩很好。但由于许多亲朋好友都对房地产经纪职业有偏见,使得他的心情越来越差。在公司里,与他同时进公司的张某原来的销售业绩远远落后于王某,最
政府监督的性质包括()。
工程寿命周期成本分析法的局限性之一是假定项目方案有()。
下列各项目中,需要进行全面清查的是( )。
蜜蜂是具有社会性行为的昆虫。一个蜂群包括一只蜂王、几只雄蜂和众多工蜂。蜂王专职产卵,雄蜂同蜂王交尾,工蜂负责采集花粉、喂养幼虫、清理蜂房等工作。蜜蜂(假设其基因型为Mm)的生殖发育过程示意图如下: A—B—C过程称为______。D的名称是_____
数据库设计分为哪几个阶段?
随着文化知识越来越重要,人们花在读书上的时间越来越多,文人学子中近视的比例也越来越高。即便在城里工人或农村农民中,也能看到不少人戴近视眼镜。然而,在中国古代,很少看到患有近视的文人学子,更别说普通老百姓了。以下除哪项外,均可以解释上述现象?
Completetheflow-chartbelow.WriteNOMORETHANTWOWORDSforeachanswer.
Chomskydefines______astheidealuser’sknowledgeoftherulesofhislanguage.
最新回复
(
0
)