Circle class - PLEASE HELP, what's wrong

Task
Implement a Circle class. Each object of this class will represent a circle, storing its radius and the x and y coordinates of its center as floats. Include a default constructor, access functions, an area() function, and a circumference() function.
So far this is what I have done, I would greatly appreciate any help, Thank you



#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <cmath>
#define PI 3.142

using namespace std;


class Circle
{


private:int r; //Data Members, declare r as an integer

float area, cir, x, y; //declare area, cir, x and y as floats

public:
Circle(); // Constructor
void getdata (void); // Methods
void putdata (void);
void calarea (void);
void calcir (void);
};
// Function Definitions
Circle :: Circle() // Constructor function

{
r = 0;
area = 0.0;


cir = 0.0;
x = 0.0;
y = 0.0;
}




void Circle :: getdata(void)
{
cout << "Please enter the radius of the circle ";
cin >> r;
cout << "Please enter the x co-ordinate of the center ";
cin >> x;
cout << "Please enter the y co-ordinate of the center ";
cin >> y;

}
void Circle :: putdata(void)
{
cout << endl;
cout << "Radius of the circle is : " << r << endl; //print with users input for r
cout << "The x-cordinate of the circle is : " << x << endl; //print with user input for x
cout << "The y-cordinate of the circle is : " << y << endl; //print with user input for y
cout << "Area of the circle is : " << PI * r * r << endl; //print with calculation answer for area
cout << "Circumference of the circle is : " << 2 * PI * r << endl; //print with calculation answer for circumference
}

main()


{
Circle c; // c is an object of class Circle

/* Here is where we clear the screen */
/*clrscr();*/
("cls");


/*system ("cls");*/


cout << " \t\t * TO IMPLEMENT A CLASS CIRCLE * \t\t " << endl;
c.getdata();
c.calarea();
c.calcir();
c.putdata();

return 0;
_getch();
}
// End of the Program









Your program is missing the implementation of some methods like Circle::calarea(void).
Topic archived. No new replies allowed.