Hello, I started C++ and I have a trouble with this thing. I can't make it work. What I am trying to do is to get the value and calculate the area of a circle using a class type of coding style.
Note that this does not even compile.
"Where should i put the cin"
#include <iostream>
using namespace std;
const double Pi = 3.1415;
class master
{
private:
double radius;
public:
void setvalue(double);
double getvalue();
double area(double);
};
void master :: setvalue(double a)
{
radius = a;
};
double master :: getvalue()
{
return radius;
};
double master :: area(radius)
{
return Pi * radius * radius;
}
int main()
{
master z01;
cout << "Please Enter A Radius \n";
cout << "Press <ENTER> to end... " << endl;
fflush(stdin);
cin.get();
}