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

题目内容 (请给出正确答案)
下面程序中错误之处是 ______。 include classA{private:intxl;protected:intx2;publ

下面程序中错误之处是 ______。

include<iostream.h>

class A{

private:

int xl;

protected:

int x2;

public:

int x3;

};

class B: public A{

private:

int b1;

protected:

int b2;

public:

int b3;

void disp(){cout<<x1<<b2<<end1;} //A

void set(int i){x3=i;} //B

};

void main()

B bb;

bb. a3=10 //C

bb. b3=10 //D

}


参考答案

更多 “ 下面程序中错误之处是 ______。 include classA{private:intxl;protected:intx2;publ 下面程序中错误之处是 ______。include<iostream.h>class A{private:int xl;protected:int x2;public:int x3;};class B: public A{private:int b1;protected:int b2;public:int b3;void disp(){cout<<x1<<b2<<end1;} //Avoid set(int i){x3=i;} //B};void main()B bb;bb. a3=10 //Cbb. b3=10 //D} ” 相关考题
考题 请在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 ② class A ③ { ④ public: ⑤ int n=2; ⑥ A(int va 以下程序中,错误的行为① #include<iostream.h>② class A③ {④ public:⑤ int n=2;⑥ A(int val) {cout < < val < < endl;}⑦ ~A( ) {};⑧ };⑨ void main( )⑩ {(11) A a (0) ;(12) }A.⑤B.⑥C.⑦D.⑩

考题 下面这个程序的结果是 include class A { private: int a; public: void seta( ) ; 下面这个程序的结果是#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.1B.2C.随机输出1或2D.程序有错

考题 下面这个程序的结果是includeclass A{private:int a;public:void seta( );int geta 下面这个程序的结果是 #include<iostream.h> class A { private: int a; public: void seta( );int geta( );}; void A::seta( ) { a = 1;} int A::geta( ) {return a;} classA.1B.2C.随机输出1或2D.程序有错

考题 下面程序的结果为includeint c;class A{private:int a;static int b;public:A( ){a 下面程序的结果为 #include<iostream.h> int c; class A { private: int a; static int b; public: A( ) {a=0;c=0;} void seta( ){a++;} void setb( ){b++;}A.1 2 1B.1 2 2C.1 1 2D.2 2 2

考题 若有以下程序:include using namespace std;class A{private: int x;protected: int 若有以下程序: #include <iostream> using namespace std; class A { private: int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; }; class B : protected A { public: void setvalue(int a, int b, int c) { setx (a); y=b; z=c; } void display() { cout<<getx ( ) <<", "<<y<<", "<<z<<", "<<end1; } }; int main () { B obj; obj.setvalue(5, 6, 7); obj.display ( ); return 0; } 程序运行后的输出结果是( )。A.产生语法错误B.7,6,5C.5,6,7D.7,5,6

考题 下面程序的结果是includeclass A{int a;public:A( ):a(1){}void showa( ){cout 下面程序的结果是 #include<iostream.h> class A { int a; public: A( ):a(1){} void showa( ){cout<<a;} }; class B { int a; public: B( ) :a(2) {}A.1B.2C.3D.程序有错误

考题 请找出下列程序中错误之处 ______。 include classA{private: intx1;protected: int 请找出下列程序中错误之处 ______。#include<iostream.h>class A{private:int x1;protected:int x2;public:int x3;};class B:public A{private:int y1;protected:int y2;public:int y3;void disp(){cout<<x1<<y1<<end1:} //Avoid set(int i) {x2=i;} //B};void main() {B bb;bb.x3=10; //Cbb.y3=10; //D}A.AB.BC.CD.D

考题 以下程序中,错误的行为①include②class A③{④public:⑤int n=2;⑥A(int val){cout 以下程序中,错误的行为①#include<iostream.h> ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout<<val<<end1;} ⑦ ~A(){}; ⑧}; ⑨void main() ⑩{ (11) A a(0); (12)}A.⑤B.⑥C.⑦D.(11)