有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a=i 有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j) {b=j;} void disp() {cout<<b<<“,”;A.10,10,10B.10,12,14C.8,10,12D.8,12,10

有以下程序:includeusing namespace std;class A{private:int a;public:A(int i){a=i

有以下程序: #include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j) {b=j;} void disp() {cout<<b<<“,”;

A.10,10,10

B.10,12,14

C.8,10,12

D.8,12,10


相关考题:

有以下程序: include using namespace std; int f(int); int main() {int i;for(i=0; 有以下程序:include <iostream>using namespace std;int f(int);int main(){int i;for(i=0;i<5;i++)cout<<f(i)<<" ";return 0;}int f(int i){static int k=1;for(;i>0;i--)k+=i;

下列程序的运行结果是 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

以下程序的执行结果是 ( )。include using namespace std;class sample{private: int 以下程序的执行结果是 ( )。 #include <iostream> using namespace std; class sample { private: int x; public: sample (int A) { x=a; } friend double square(sample s); }; double square(sample s) {A.20B.30C.900D.400

有以下程序:include using namespace std;class A{private: int x,y;public: void se 有以下程序: #include <iostream> using namespace std; class A { private: int x,y; public: void set (int i,int j) { x=i; y=j; } int get_y() { return y; } }; class box { private: int length,width; A label; public: void set(int 1,int w, int s,int p) { length=1; width=w; label.set(s,p); } int get_area() { return length*width; } }; int main() { box small; small.set(2,4,1,35); cout<<small.get_area()<<end1; return 0; } 运行后的输出结果是( )。A.8B.4C.35D.70

下面程序的运行结果为includeclass A{ int num;public: A(int){num=i;} A(ABm){num 下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int){num=i;} A(ABm){num=a.num++;} void print(){cout<<num;} }; void main() { Aa(1),b(a); a.print(); b.print(); }A.11B.12C.21D.22

分析以下程序的执行结果【】。include class S{ int A[10]; public: int operato 分析以下程序的执行结果【 】。include <iostream. h>class S{int A[10];public:int operator () (int);};int S: :operator() (int x) {return A[x];}void main() {S a;int i,j;for (i=0; i<10; i++)a(i)=i*2;for (i=0; i<10; i++)cout<<a(i)<<" ";cout<<end1; }

有以下程序:include using namespace std;define PI 3.14class Point{ private:int 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }A.314B.157C.78.5D.153.86

若有以下程序:include using namespace std;class A{private: int a;public: A(int 若有以下程序: #include <iost ream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<", "; } }; class B { private:A.10,10,10B.10,12,14C.8,10,12D.8,12,10

阅读下列说明和C++代码,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下C++代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分类及其关系如图6-1所示。【C++代码】#include?#include?using?namespace?std;class?DrawCircle?{??????//绘制圆形,抽象类? ? ? public: (1);//定义参数为?int?radius,?int?x,?inty? ?virtual~DrawCircle()?{?}};class?RedCircle:public?DrawCircle?{????//绘制红色圆形? ? ? ? public: void?drawCircle(intradius,?int?x,?int?y)?{cout??drawCircle?=?drawCircle;? }? ?virtual~shape()?{?}? public:? ?virtual?void?draw()?=?0;};class?Circle:public?Shape?{????//圆形? ? private:? ? ?int?x,y,radius;? ? public:? Circle(int?x,inty,int?radius,DrawCircle?*drawCircle)? (3)? {? this->x?=?x;? ?this->y?=?y;? ? this->radius?=?radius; }? ? ? public:? void?draw(){? drawCircle?-> (4); }};int?main(){Shape?*redCirclenew?Circle(100,100,10,????(5)????);//绘制红色圆形? Shape?*greenCircle=new?Circle(100,100,10, (6)??);//绘制绿色圆形redCircle >draw();? ?greenCircle?->draw();? ?return?0;}