what does these instructions mean when it says "initialize pi with the value 3.14" ..... how can i initialize that variable? The instructions don't list any functions that i can use to set pi to 3.14...... so is this telling me to initialize the pi variable inside the class like i have done below or is there some other way i can do this
1 2 3 4 5 6 7 8 9 10 11 12
class Circle
{
private:
double radius;
double pi = 3.14;
public:
Circle();
Circle(int r);
void setRadius(int r);
double getRadius() const;
double getArea() const;
};
Write a Circle Class that has the following member variables:
radius: a double
pi: a double initialized with the value 3.14
The class should have the following member functions:
Default Constructor - a default constructor that sets radius 0.0
Constructor - accepts the radius of the circle as an argument
setRadius - A mutator method for the radius variable
getRadius - An accessor method for the radius variable
getArea - Returns the area of the circle
struct A
{
int value = 0 ;
std::string name = "anon" ;
A() {} // value initialized with 0, name initialized with "anon"
A( int i ) : value(i) {} // value initialized with i, name initialized with "anon"
A( constchar* n ) : name(n) {} // value initialized with 0, name initialized with n
A( int i, constchar* n ) : value(i), name(n) {} // value initialized with i, name initialized with n
};