c++程序填空题
完成如下的程序,使得输出为:1234#include<iostream.h>#include<math.h>classA{private:________(1)_____...
完成如下的程序,使得输出为:
1234
#include <iostream.h>
#include <math.h>
class A
{
private:
________(1)___________
protected:
________(2)__________
public:
A(int a, int b, int c)
{
X=a;
Y=b;
Z=c;
}
int GetX()
{
return X;
}
int GetY()
{
return Y;
}
int GetZ()
{
return Z;
}
};
class B _____(3)_______
{
private:
int K;
public:
B(int a, int b, int c, int d)_______(4)_________
{
K=d;
}
void Show()
{
cout << GetX() << GetY() << Z << K << endl;
}
};
void main()
{
B b(1,2,3,4);
b.Show();
} 展开
1234
#include <iostream.h>
#include <math.h>
class A
{
private:
________(1)___________
protected:
________(2)__________
public:
A(int a, int b, int c)
{
X=a;
Y=b;
Z=c;
}
int GetX()
{
return X;
}
int GetY()
{
return Y;
}
int GetZ()
{
return Z;
}
};
class B _____(3)_______
{
private:
int K;
public:
B(int a, int b, int c, int d)_______(4)_________
{
K=d;
}
void Show()
{
cout << GetX() << GetY() << Z << K << endl;
}
};
void main()
{
B b(1,2,3,4);
b.Show();
} 展开
展开全部
//1234
#include <iostream.h>
#include <math.h>
class A
{
private:
//________(1)___________
int X,Y;
protected:
//________(2)__________
int Z;
public:
A(int a, int b, int c)
{
X=a;
Y=b;
Z=c;
}
int GetX()
{
return X;
}
int GetY()
{
return Y;
}
int GetZ()
{
return Z;
}
};
class B : public A//_____(3)_______
{
private:
int K;
public:
B(int a, int b, int c, int d): A(a,b,c)//_______(4)_________
{
K=d;
}
void Show()
{
cout << GetX() << GetY() << Z << K << endl;
}
};
void main()
{
B b(1,2,3,4);
b.Show();
}
//别忘了给分~
#include <iostream.h>
#include <math.h>
class A
{
private:
//________(1)___________
int X,Y;
protected:
//________(2)__________
int Z;
public:
A(int a, int b, int c)
{
X=a;
Y=b;
Z=c;
}
int GetX()
{
return X;
}
int GetY()
{
return Y;
}
int GetZ()
{
return Z;
}
};
class B : public A//_____(3)_______
{
private:
int K;
public:
B(int a, int b, int c, int d): A(a,b,c)//_______(4)_________
{
K=d;
}
void Show()
{
cout << GetX() << GetY() << Z << K << endl;
}
};
void main()
{
B b(1,2,3,4);
b.Show();
}
//别忘了给分~
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询