判断题
错误
使用VC++6.0打开考生文件夹下的源程序文件3.cpp。请完成以下部分,实现在屏幕上输出为 C3 C2 这个...
未知题型使用VC++6.0打开考生文件夹下的源程序文件3.cpp。请完成以下部分,实现在屏幕上输出为 C3 C2 这个程序需要修改的部分,请按照以下部分实现。 (1)类C0不能被实例化,请定义一个纯虚函数print,在注释1后添加适当的语句。 (2)类C1私有虚继承类C0,请在注释2后添加适当的语句。 (3)类C2公有继承于C0,请在注释3后添加适当的语句。 (4)类c3公有继承于C2与C1,请在注释4后添加适当的语句。 注意:增加代码或者修改代码的位置已经用符号表示出来。请不要修改其他的程序代码。 试题程序: include(iostream.h) classCO { //********1******** }; //********2******** classC1: { public: voidprint { cout<'”C1'<<endl; } }; //********3******** classC2: { public: voidprint { cout<<'C2'<<endl; } }; //********4***x**** classC3: { public: voidprint { cout<<'C3'<<endl; } }; voidmain { C30bj3; C20bj2; obj3.print; obj2.print; return; }
使用VC++6.0打开考生文件夹下的源程序文件 1.cpp,该程序运行时有错误,请改正程序中的错误。本程序要求...
未知题型使用VC++6.0打开考生文件夹下的源程序文件 1.cpp,该程序运行时有错误,请改正程序中的错误。本程序要求实现的功能为从键盘输入一个字符串,并将结果保存到文件1.txt中。 注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在 //******error******的下面。 试题程序: include<iostream> include<fstream> //********error******** usingstd; voidWriteFile(char*s) { ofstreamout1; //********error******** out1.open('1.txt',binary|app); for(inti=0;s[i]!=0;i++) { //********error******** out1.puts(s[i]); } out1.close; } voidClearFile { ofstreamout1; out1.open('1.txt'); out1.close; } intmain { chars[1024]; ClearFile; cout<<'pleaseinputastrin9:'<<endl; cin.getline(s,1024); WriteFile(s); return0; }
单项选择题