C++源程序修改

来源:百度知道 编辑:UC知道 时间:2024/05/23 09:37:53
/*为什么错了?请帮忙调试。要在同一个工程下添加2Dspace.cpp;linear2Dspace.cpp;Euclid2Dspace.cpp;main.cpp四个文件。*/

/*2Dspace.cpp*/
#include<iostream>
using namespace std;
class a2Dspace
{
public:
a2Dspace();
~a2Dspace();
void setP(a2Dspace P);
void getP(a2Dspace P);
protected:
float x;
float y;
};
a2Dspace::a2Dspace()
{
cout<<"+point in 2Dspace";
x=0;
y=0;
}
a2Dspace::~a2Dspace()
{
cout<<"-point in 2Dspace";
}
void a2Dspace::setP(a2Dspace P)
{
cout<<"please enter the value of X";
cin>>x;
cout<<"please enter the value of Y";
cin>>y;
getP(P);
}
void a2Dspace::getP(a2Dspace P)
{
cout<<"now the point is ("<<x<<','<<y<<')'<<endl;
}

/*linear2Dspace.cpp*/
#ifndef

要include的话还是用头文件比较好吧。。。include cpp文件总感觉怪怪的。

你着个程序有问题把,自定义变量再那里 主语再那里`?
没自定义变量 你下边的那些是啥东西要干什么`?