Fri Feb 01, 2013 12:00 am
// ircle.cpp: implementation of the Circle class.
//
#include<iostream>
using namespace std;
//////////////////////////////////////////////////////////////////////
#include<math.h>
#include "ircle.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Circle::Circle()
{
}
Circle::~Circle()
{
}
double Circle ::Getdiameter()
{
return Radius*2;
}
double Circle ::Getarea()
{
double area;
area=(3,14*Radius*Radius);
return area;
}
bool Circle ::Included(Point P1,Point P2)
{
Length=sqrt((P1.SetX()-P2.SetX())^2+(P1.SetY()-P2.SetY())^2);
if(Length>Radius)
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////////////////////
int Circle ::Cir_Cir(Point P1, Point P2,int r)
{
if((Radius==r&&P1.SetX()==P2.SetX())&&(P1.SetY()==P2.SetY()))
{
pass=Equal;
return pass;
}
else if((Radius>=r&&Length<=Radius))
{
pass=included;
return pass;
}
else if (Radius>=r&&Length>Radius||Radius<=r&&Length>r)
{
pass=Disjoint;
return pass;
}
else if (Radius<=r&&Length<=r)
{
pass=Super;
return pass;
}
else
pass=Intercepted;
return pass;
}
void Circle ::GetDstance(Point P1,Point P2)
{
Length=sqrt((P2.SetX()-P1.SetX())^2+(P2.SetY()-P1.SetY())^2);
}
void Circle ::GetRadius(int r)
{
Radius=r;
}
int Circle::SetRadius()
{
return Radius;
}
int Circle ::Test(Point P)
{
return 0;
}
// ircle.h: interface for the Circle class.
//
//////////////////////////////////////////////////////////////////////
#include "Point.h"
#if !defined(AFX_IRCLE_H__12EBF9DB_8FA6_4245_AA48_97AEA3A3605E__INCLUDED_)
#define AFX_IRCLE_H__12EBF9DB_8FA6_4245_AA48_97AEA3A3605E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
enum Pass{Disjoint,included,Super,Intercepted,Equal};
class Circle:public Point
{
public:
Circle();
virtual ~Circle();
//////////////////////////////////////////////////////////////////////////////////////////////
void GetRadius(int r);
int Cir_Cir(Point P1,Point P2,int r);
int SetRadius();
double Getdiameter();
double Getarea();
bool Included(Point P1,Point P2);
void GetDstance(Point P1,Point P2);
int Test(Point P);
protected :
int Radius;
double Length;
Pass pass;
};
#endif // !defined(AFX_IRCLE_H__12EBF9DB_8FA6_4245_AA48_97AEA3A3605E__INCLUDED_)
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.