题目内容

请使用VC6或使用[答题]菜单打开考生文件夹proj2下的工程proj2。此工程中包含一个源程序文件main.cpp,其中有“书”类Book及其派生出的“教材”类TeachingMaterial的定义,还有主函数main的定义。请在横线处填写适当的代码并删除横线,以实现上述类定义和函数定义。该程序的正确输出结果应为: 教材名:C++语言程序设计 页数:299 作者:张三 相关课程:面向对象的程序设计 注意:只在横线处填写适当的代码,不要改动程序中的其他内容,也不要删除或移动“//****found****”。 #include <iostream> using namespace std; class Book{ //"书"类 char * title; //书 int num_pages; //页数 char * writer; //作者姓名 public: //********** found********** Book(const char * the title, int pages, const char * the writer): ______{ title =new char[ strlen (the_titie) +1]; strcpy(title,the_title); //********** found********** ______ strcpy(writer,the_writer); } ~Book(){ delete []title; delete []writer; } int numOfPages()const{ return numpages;} //返回书的页数 const char * theTitle () const { return title; } //返回书名 const char * theWriter () const{ return writer; } //返回作者名 }; class TeachingMaterial: public Book{ //“教材”类 char * course; public: TeachingMaterial (const char * the_title, int pages, const char * the_writer, const char * the_course) //********** found********** :______{ course = new char [ strlen (the_course) +i]; strcpy (course, the_course); } ~TeachingMaterial () { delete [ ]course; } const char * theCourse () const{ return course; } //返回相关课程的名称 }; int main () { TeachingMaterial abook ("C++语言程序设计", 299, "张三", "面向对象的程序设计"); cout <<"教材名:" << a book.theTitle() <<endl << "页数:" << a_book.numOfPages ()<< endl <<"作者:" <<a book.theWriter ()<< endl //********** found********** << "相关课程:" <<______; cout << endl; return 0; }

查看答案
更多问题

请使用VC6或使用[答题]菜单打开考生文件夹proj1下的工程proj1,此工程中包含源程序文件main.cpp,其中有ElectricFan(“电风扇”)类和主函数main的定义。程序中位于每个“//ERROR ****found****”之后的一行语句有错误,请加以改正。改正后程序的输出结果应该是: 品牌:清风牌,电源:关,风速:0 品牌:清风牌,电源:开,风速:3 品牌:清风牌,电源:关,风速:0 注意:只修改每个“//ERROR ****found****”下的那一行,不要改动程序中的其他内容。 #include <iostream> using namespace std; class ElectricFan { //"电扇"类 char * brand; int intensity; //风速: 0-关机 1-弱, 2-中, 3-强 public: ElectricFan (const char * the_brand) : intensity(0) { brand = new char [strlen (the_brand) +1]; strcpy(brand, the_brand); } ~ElectricFan() { delete []brand; } const char * theBrand () const { return brand; } //返回电扇品牌 int theIntensity () const { return intensity; } //返回风速 // ERROR ********** found********** bool isOn()const{ return intensity==0;} //返回电源开关状态 // ERROR ********** found********** void turnOff () const { intensity =0;} //关电扇 void setIntensity (int inten) { //开电扇并设置风速 if(inten>=1 && inten<=3) //ERROR ********** found********** inten = intensity; } void show () { cout <<"品牌:" << theBrand () << "牌" <<",电源:" << (isOn () "开": "关") <<",风速:" <<theIntensity() << endl; } }; int main(){ ElectricFan fan("清风"); fan.show(); fan.setIntensity(3); fan.show(); fan.turnOff(); fan.show(); return 0; }

会计信息系统实质是将会计数据转化为会计信息的系统,是企业管理系统的一个重要子系统。( )

A. 对
B. 错

企业自行开发会计软件的优点是( )。

A. 针对性强
B. 开发要求高
C. 费用高
D. 开发周期长

若关于x的二次方程mx2-m-1)x+m-5=0有两个实根α、β,且满足-1<a<0和0<β<1,则m的取值范围是______.

A. 3<m<4
B. 4<m<5
C. 5<m<6
D. m>6或m<5
E. m>5或m<4

答案查题题库