更多"在下面程序的横线处填上适当的语句,使该程序的输出为12。 #inc"的相关试题:
[填空题]在下面程序的横线处填上适当的语句,使该程序执行结果为10。
#include <iostream>
using namespace std;
class MyClass
public:
MyClasS(int A)
X=a;
【13】 //取x的值
private:
int x;
;
int main( )
MyClass my(10);
cout<<my.GetNum( )<<end1;
return 0;
[填空题]在下面程序的横线处填上适当的语句,使该程序的输出为12。
#include <iostream>
using namespace std;
class Base
{
public:
int a;
Base(int i){ a=i; }
class Derived : public Base
{
int a;
public:
Derived(int x) : Base(x),b(x+1){}
void show( )
{
______; //输出基类数据成员a的值
cout<<b<<endl;
}
};
int main ( )
{
Derived d(1);
d.show( );
return 0;
}
[简答题]在下面程序横线处填上适当的语句,使其输出结果为0,15,15。
#include<iostream.h>
class base
public:
______f( )return 0;
;
class derived:public base
public:
int a,b,c;
______set(int x,int y,int z)a=x;b=y;c=z;
int f( )return a+b+c;
;
void main( )
base b;
derived d;
cout<<b.f( )<<",";
d.set(3,5,7);
cout<<d.f( )<<",";
base &p=d;
cout<<p.f( )<<endl;
[填空题]在下面的程序的横线处填上适当的语句,使该程序的输出为12。
#include<iostream.h>
using namespace std;
class Base
{
public:
int a,b;
Base(int i){a=i;}
};
class Derived:public Base
{
int a;
public:
Derived(int x):Base(x),b(x+1){};
void show( )
{
______;//输出基类数据成员a的值
cout<<b<<endl;
}
};
int main( )
{
Derived d(1);
d.show( );
return 0;
[填空题]在下面的程序的横线处填上适当的语句,是该程序的输出为12。
#include<iostream>
using namespace std;
class Base
public:
int a;
Base(int i)a=i;
;
class Derived:public Base
int a;
public:
Derived(int x):Base(x),b(x+1)
void show( )
【11】 ; //输出基类数据成员a的值。
cout<<b<<endl;
;
int main( )
Derived d(1);
d.show( );
return 0;
[填空题]在下面的程序的横线处填上适当的语句,使该程序的输出为12。
#include <iostream>
using namespace std;
class Base
public:
int a,b;
Base(int i) a=i;
;
class Derived: public Base int a;
public:
Derived(int x): Base(x),b(x+1)
void show( )
【13】 ; //输出基烃数据成员a的值。
cout<<b<<end1;
;
int main( ) Derived d(1);
D. show( );
return 0;
[填空题]在下面的程序的横线处填上适当的语句,使该程序的输出为12。
#include<iostream.h>
using namespace std;
class Base
public:
int a,b;
Base(int i)a=i;
;
class Derived:public Base
int a;
public:
Derived(int x):Base(x),b(x+1);
void show( )
______;//输出基类数据成员a的值
cout<<b<<endl;
;
int main( )
Derived d(1);
d.show( );
return 0;
[填空题]在下列的程序的横线处填上适当的语句,使该程序的输出为12。
#include<iostream.h>
using namespace std;
class Base
{
public:
int a,b;
Base(int i){a=i;}
};
class Derived:public Base
{
int a;
public:
Derived(int x):Base(x),b(x+1){};
void show( )
{
______;//输出基类数据成员a的值。
cout<<b<<endl;
}
};
void main( )
{
Derived d(1);
d.show( );
return 0;
}