//File:	circle_struct.cpp
#include <iostream>
#include <string>
using namespace std;

const double PI=3.14159;

struct circle
{
	//Member data fields
	double m_rad;
	double m_x, m_y;
	string m_name;
	
	//Member functions -- DON'T HAVE THESE IN C
	circle()	//Constructor
	{
		m_x=0.0;
		m_y=0.0;
		m_rad=1.0;
		m_name="Unit Circle";
	}
	
	//Overloaded constructor
	circle (double xcoord, double ycoord, double radius, string name)
	{
		m_x=xcoord;
		m_y=ycoord;
		m_rad=radius;
		m_name=name;
	}
	
	~circle()	//Destructor
	{
	}
	
	//NOTE:	Constructors and destructors are called automatically.
	//	You're not permitted to call them yourself.
	//	Also, note that they have no return type.
	
	//Accessor Methods
	double circumference() const	//The use of const here prevents
					//changing or updating the member data.
	{
		return (m_rad*2.0*PI);
	}
	
	double radius() const
	{
		return m_rad;
	}
	
	string name() const
	{
		return m_name;
	}
	
	void center (double & xcoord, double & ycoord) const
	{
		xcoord=m_x;
		ycoord=m_y;
	}
};

int main()
{
	circle c, d(1.0, 3.0, 5.0, "Test Circle");
	double x, y;
	
	c.center(x,y);
	cout << c.name() << " is located at (" << x << "," << y << ")" << endl;
	cout << "Its radius is: " << c.radius() << endl;
	cout << "Its circumference is: " << c.circumference() << endl;
	cout << endl;
	
	d.center(x,y);
	cout << d.name() << " is located at (" << x << "," << y << ")" << endl;
	cout << "Its radius is: " << d.radius() << endl;
	cout << "Its circumference is: " << d.circumference() << endl;
	cout << endl;
	
	return 0;
}
