填空题

在下面横线上填上适当的语句,完成程序。
#include<iostream>
using namespace std;
class Base
int x;
public:
Base(int i)x=i;
~Base()
;
class Derived:public Base
public:
//完成类Derive构造函数的定义
;
int main()
Derived Obj;
return 0;

【参考答案】

Derived(int i):Base(i){
<上一题 目录 下一题>
热门 试题

填空题
有如下程序: #included<iostream> using namespace std; class CA public: CA()cout+’A’; ; class CB:private CA public: CB()cout<<’B’; ; int main() CA a; CB b; return 0; 这个程序的输出结果是______。
填空题
下列程序用于将源文件中的字母进行大小写转换,请填写while语句。 #include<iostream.h> #include<fstream.h> #include<iomanip.h> void main() char ch; fstream file1,file2; char fn1[10],fn2[10]; cout<< 输入源文件名: ; cin>>fn1; cout<< 输入目标文件名: ; cin>>fn2; file1.open(fn1,ios::in); while(______) if(ch>=’a’&&ch<=’z’) ch=ch=’a’+’A’; file2.put(ch); file1.close(); file2.close();
相关试题
  • 下列程序的输出结果是______。 #in...