题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-25 00:53:24

[单项选择]下面这个程序的结果是
#include<iostream.h>
class A

private:
int a;
public:
void seta( );int geta( );;
void A::seta( )
a = 1;
int A::geta( )
return a;
class B
private:
int a;
public:
void seta( );int geta( );;
void B::seta( )
a=2;
int B::geta( )
return a;
class C://public A,public B
private:
int b;
public:
void display( );;
void C::display( )
int b=geta( );
cout <<b;
void main( )
C c;
c.seta( );
c.display( );
A. 1
B. 2
C. 随机输出1或2
D. 程序有错

更多"下面这个程序的结果是 #include<iostream.h> "的相关试题:

[单项选择]下面这个程序的结果是
#include<iostream.h>
class A

private:
int a;
public:
void seta( );int geta( );;
void A::seta( )
a = 1;
int A::geta( )
return a;
class B
private:
int a;
public:
void seta( );int geta( );;
void B::seta( )
a=2;
int B::geta( )
return a;
class C://public A,public B
private:
int b;
public:
void display( );;
void C::display( )
int b=geta( );
cout <<b;
void main( )
C c;
c.seta( );
c.display( );
A. 1
B. 2
C. 随机输出1或2
D. 程序有错
[单项选择]下面这个程序的结果是
#include<iostream.h>
class A

private:
int a;
public:
void seta( ) ;int geta( ) ;;
void A: :seta( )
a=1;
int A: :geta( )
retum a;
class B
private:
int a;
public:
void seta( ) ;int geta( ) ;;
void B: :seta( )
a=2;
int B: :geta( )
return a;
class C: public A,public B
private:
int b;
public:
void display( ) ;;
void C: :display( )
int b=geta( ) ;
cout < < b;
void main( )
C c;
c. seta( ) ;
c. display( ) ;
A) 1 B) 2
C) 随机输出1或2 D) 程序有错
[单项选择]下面程序的结果是
    #include<iostream.h>
    class A
     public:
      A( ) cout < < "construtA" < < end1;
      virtual ~A( ) cout < < "destructA" < < end1; ;
    class B:public A
     ;
    class C://public A
     ;
    class D://public B,public C
     ;
    void main( )
     Dd;
A. constructA
B. constructA
C. constructA
D. constructA
[单项选择]下面程序的结果是    #include<iostream.h>    class A    {     int a;     public:      A( ):a(1){ }      void showa( ){ cout < < a;}    };    class B    {     int a;     public:      B( ):a(2){ }      void showa( ) { cout < < a;}    };    class C://public A,public B    {     int a;     public:      C( ):a(3) { }      void showa( ) {cout < < a;}    };    void main( )    {     C c;     c.showa( );    }
A. 1
B. 2
C. 3
D. 程序有错误
[单项选择]下面程序的结果是   #include<iostream.h>   class test{ private:         int num;       public:        test( );        int getint( ) {return num;}        ~test( );};   test::test( )   { num=0;}   test::~test( )   { cout<<"Destructor is active"<<endl;}   void main( )   { test x[3];     cout<<"Exiting main"<<endl;}
A. Exiting main  Destructor is active  Destructor is active  Destructor is active
B. Exiting main  Destructor is active  Destructoris active
C. Exiting main  Destructoris active
D. Exiting main
[单项选择]下面程序的结果是 #include<iostream.h> class A { public: A( ) {cout<<"construtA"<<endl;} virtual~A( ) {cout<<"destructA"<<endl;}}; class B:public A {}; class C://public A {}; class D://public B,public C {}; void main( ) { D d;}
A. constructA destructA
B. constructA constructA destructA destructA
C. constructA constructA constructA destructA destructA destructA
D. constructA  onstructA constructA constructA destructA destructA destructA destructA
[单项选择]下面程序的运行结果是
#include<iostream.h>
class base
protected:
int a;
public:
base( )cout <<"0";

class basel:virtual base
public:
basel ( ) cout <<"1";

class base2:virtual base
public:
base2( )cout <<"2";

class derived:public basel,public base2
public:
derived( )cout <<"3";

void main( )

derived obj;
cout <<end1;

A. 0123
B. 3120
C. 0312
D. 3012
[单项选择]下面程序的结果是( )。    #include<iostream.h>    class test{ private:          int num;        public:         test( );         int getint( ) {return num;}         ~test( );};    test::test( )    { num=0;}    test::~test( )    { cout<<"Destructor is active"<<endl;}    void main( )    { test x[3];      cout<<"Exiting main"<<endl;}
[单项选择]分析下面程序,该程序的运行结果是( )。
#include<iostream.h>
class cmm

public:
static int m;
cmm( )

m++;

cmm(int n)

m=n;

static void testm( )

m++;

;
int cmm :: m=0;
void main( )

cmm A;
cmm B(3);
A. testm();
B. m=3
C. m=4
D. m=5
E. m=6
[单项选择]下面程序的结果是
#include<iostream.h>
class A

int a;
public:
A( ) :a(1)
void showa ( ) cout < < a;
;
class B

int a;
public:
B( ) :a(2)
void showa( ) cout < < a;
;
class C: public A, public B

t a;
public:
C( ) :a(3)
void showa( ) cout < < a;
;
void main( )

C c;
c.showa( ) ;

A. 1
B. 2
C. 3
D. 程序有错误
[单项选择]下面程序的运行结果是( )。   #include<iostream.h>   class base{   protected:     int a;   public:     base( ){cout<<"0";}   };   class basel:virtual base{   public:     basel( ){cout<<"1";}   };   class base2:virtual base{   public:     base2( ){cout<<"2";}   };   class derived:public basel,public base2{   public:     derived( ){cout<<"3";}   };   void main( )   {     derived obj;     cout<<endl;   }
A. 123
B. 3120
C. 312
D. 3012
[单项选择]下面程序的运行结果是( )。
#include<iostream.h>
class Sampleint x, y;
public:
Sample( ) x=y=0;
Sample(int a, int b) x=a; y=b;
void (lisp( )cout<<"x="<<x<<",y="<<y<<end1;;
void main( )Sample s(2,3), *p=&s;
p->disp( );

A. x=1, y=2
B. x=2, y=4
C. x=2, y=3
D. x=4, y=3
[单项选择]下面程序的结果是( )。
#include<iostream.h>
class A

int a;
public:
A. 1
B. 2
C. 3
D. 程序有错误

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码