C++程序题谁会写
来源:百度知道 编辑:UC知道 时间:2024/05/21 18:37:07
1.1. 根据已有程序和输出结果完成下面的程序。
#include <iostream.h>
#include <math.h>
class Point
{
private:
_______
protected:
_______
public:
Point(float a, float b, float c){__________}
float Getx(){return X;}
float Gety(){return Y;}
float Getz(){return Z;}
};
class Line:_______Point
{
private:
float m;
public:
Line(float a, float b, float c, float d)_______
{_________}
void show()
{
cout<<Getx()<<endl;
cout<<Gety()<<endl;
cout<<Y<<endl;
c
#include <iostream.h>
#include <math.h>
class Point
{
private:
_______
protected:
_______
public:
Point(float a, float b, float c){__________}
float Getx(){return X;}
float Gety(){return Y;}
float Getz(){return Z;}
};
class Line:_______Point
{
private:
float m;
public:
Line(float a, float b, float c, float d)_______
{_________}
void show()
{
cout<<Getx()<<endl;
cout<<Gety()<<endl;
cout<<Y<<endl;
c
第一题:
结果只有六个吧
float X;
float Y,float Z;
X=a,Y=b,Z=c;
public
Point(a,b,c)
m=d;
第二题:
i+k=-858993460 j+k=-858993460
(因为你的默认构造函数中没有给参数赋值)
i+k=15 j+k=25
我运行程序有问题,你的show函数里定义输出6个数据,到运行结果里怎么变成7个了?我只写出来5个空,第一个没写出来。
float x,y,z;
x=a;y=b;z=c;
public
Point(a,b,c)
m=a;