网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
根据输出结果填空完成下面程序。 include class Test { private: static int val; in

根据输出结果填空完成下面程序。

include<iostream.h>

class Test

{

private:

static int val;

int a;

public:

static int func( );

void sfunc(Test &r);

};

______//初始化静态变量val

int Test::func( )

{

return val++;

}

void Test::sfunc(Test &r)

{

r.a=125;

cout<<"Result3="<<r.a;

}

void main( )

{

cout<<"Resultl="<<Test::func( )<<endl;

Test A;

cout<<"Result2="<<A.fune( )<<endl;

A. sfunc(A);

}

输出结果为:

Result1=201

Result2=202

Result3=125


参考答案

更多 “ 根据输出结果填空完成下面程序。 include class Test { private: static int val; in 根据输出结果填空完成下面程序。include<iostream.h>class Test{private:static int val;int a;public:static int func( );void sfunc(Test r);};______//初始化静态变量valint Test::func( ){return val++;}void Test::sfunc(Test r){r.a=125;cout<<"Result3="<<r.a;}void main( ){cout<<"Resultl="<<Test::func( )<<endl;Test A;cout<<"Result2="<<A.fune( )<<endl;A. sfunc(A);}输出结果为:Result1=201Result2=202Result3=125 ” 相关考题
考题 请在mian函数中填空使下面程序的输出结果为1 1。 include class A { private: 请在mian函数中填空使下面程序的输出结果为1 1。include<iostream.h>class A{ private:int a;int b;public:A( ):a(0) ,b(1) { }void show( ) { cout < < a < < " " < < b;} };class B{ private:int a;int c;public:B( ):a(1),

考题 下列程序的输出结果为( )。 #include<iostream.h) class TestClass { public: TestClass(){val++;} static,int val; }; int TestClass::val=0; void main() { TestClass cs1; cout<<csl.val<<““; TestClass cs2; TestClass cs3,cs4; coA.03B.13C.14D.24

考题 下列程序的运行结果是【 】。 include class test { private: int num; public: tes 下列程序的运行结果是【 】。include <iostream. h>class test{private:int num;public:test()int TEST() {return num+100;}~test()};test::test(){num=0;}test::~test(){cout<<"Destructor is active"<<endl;}void main(){test x[3]cout<<x[1]. TEST()<<endl;}

考题 下面程序运行时输出结果为【】。 include include class Rect { public: Rec 下面程序运行时输出结果为【 】。include<iostream.h>include<malloc.h>class Rect{public:Rect(int1,int w)(length=1;width=w;)void Print(){cout<<"Area:"<<length *width<<endl;)void *operator new(size-t size){return malloc(size);}void operator delete(void *p){free(p)private:int length,width;};void main(){Rect*p;p=new Rect(5,4);p->Print();delete p;}

考题 下列程序的运行结果是______。 include class test { private: int hum; public: tes 下列程序的运行结果是______。include<iostream.h>class test{private:int hum;public:test( );int TEST( ){return num+100;)~test( );};test::test( ){num=0;)test::~test( ){cout<<"Destructor is active"<<endl;)void main( ){test x[3];cout<<x[1].TEST( )<<endl;}

考题 下列程序的运行结果是 includeclass Location{private:int X.Y;public:void init(i 下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueYA.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2

考题 下面程序的输出结果是()。includeinclude"string.h"void main(){char a[]="Hello T 下面程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; } A) B)C) D)A.HelloB.TestC.Hello TestD.Hello Test HelloTest

考题 下面程序的输出结果为()。includeclass CStatic{public:CStatic() {val++;}static i 下面程序的输出结果为( )。#include<iostream.h>class CStatic{public:CStatic() {val++;}static int val;};int CStatic::val=0;void main(){CStatic cs1;cout<<cs1.val<< "";CStatic cs2;CStatic cs3, cs4;cout<<cs val<<end1;}A.14B.24C.34D.54

考题 下面程序的结果是 include class test{private: int num; publi 下面程序的结果是 #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;} voidA.Exiting main Destructor is active Destructor is active Destructor is activeB.Exiting main Destructor is active Destructoris activeC.Exiting main Destructoris activeD.Exiting main