问题

( 11 )有如下程序:

#include<iostream>

using namespace std;

class Monitor{

public:

Monitor ( char t ) : type ( t ) {}

void print ( ) const

{cout$amp;private:

char type;

};

class Computer{

public:

Computer ( int i , char c ) : 【 11 】 {}

void Print () const

{cout$amp;private:

int id;

Monitor mon;

};

const Computer myComputer ( 101,'B' ) ;

myComputer .Print ( ) ;

return 0;

}

请将程序补充完整,使程序在运行时输出:

The computer is 101

'The type of monitor i.s 8

参考答案
您可能感兴趣的试题
  • ( 12 )有如下程序:#include using namespace stdclass Animal{public:virtual char* getType () const
  • ( 13 )补充完整下面的类定义:const double PI=3 .14;class Circle{ // 圆形物体的抽象基类protected:double r; // 半径public:Cir
  • ( 14 )补充完整下面的类定义:class XCH{char* a;public:XCH ( char* as ) { // 构造函数a=new char[strlen ( aa ) +1];str
  • ( 15 )补充完整下面的模板定义:template //Type 为类型参数class Xtwo{ // 由两个 Type 类型的数据成员构成的模板类Type a;Type
  • ( 3 )对于循环队列,下列叙述中正确的是A )队头指针是固定不变的B )队头指针一定大于队尾指针C )队头指针一定小于队尾指针D )队头指针可以大于队尾指针,也可以小于队尾指针
  • ( 4 )算法的空间复杂度是指A )算法在执行过程中所需要的计算机存储空间B )算法所处理的数据量C )算法程序中的语句或指令条数D )算法在执行过程中所需要的临时工作单元数