没事我就是找个地...吧 关注:1贴子:120
  • 1回复贴,共1

防止脑残备份

只看楼主收藏回复


#ifndef POINT_H
#define POINT_H
class Point
{int x,y;
public:
Point (int=0,int=0);
void SetPoint(int,int);
int GetX(){return x;}
int GetY(){return y;}
void Print();
};
#endif
#include <iostream>
using namespace std;
#include "Point.h"
Point::Point(int a,int b){SetPoint(a,b);}
void Point::SetPoint(int a,int b)
{
x=a;
y=b;
}
#ifndef
int main()
{
struct circle
{ }
return 0;
}



1楼2012-04-19 17:02回复

    #ifndef POINT_H
    #define POINT_H
    class Point
    {int x,y;
    public:
    Point (int=0,int=0);
    void SetPoint(int,int);
    int GetX(){return x;}
    int GetY(){return y;}
    void Print();
    };
    #endif
    #include <iostream>
    using namespace std;
    #include "Point.h"
    Point::Point(int a,int b){SetPoint(a,b);}
    void Point::SetPoint(int a,int b)
    {
    x=a;
    y=b;
    }
    #ifndef CIRCLE_H
    #define CIRCLE_H
    #include <iostream>
    using namespace std;
    #include "Point.h"
    class Circle:public Point
    {double radius;
    public:
    Circle(int x=0,int y=0,double r=0.0);
    void SetRadius(double);
    double GetRadius();
    double Area();
    };
    #endif
    #include <iostream>
    using namespace std;
    #include "Circle.h"
    Circle::Circle(int a,int b,double r):Point(a,b){SetRadius(r);}
    void Circle::SetRadius(double r){radius=(r>=0?r:0);}
    


    2楼2012-04-19 17:25
    回复