### Class

First of all, I kinda dont know is this mean (English is my 7th lag)
I got the first part but now the second part:

 ``123`` ``````A. Write a statement that defines an array of 5 objects of the Circle class. Let the default constructor execute for each element of the array. B. Write a statement that defines an array of 5 objects of the Circle class. Now pass the following arguments to the elementsâ€™ constructor: 12, 7, 9, 14 and 8. C. Write a for loop that displays the radius and area of the circles represented by the array that you defined in part B of this problem.``````

 ``1234567891011121314151617181920212223242526272829303132333435363738394041`` ``````#include using namespace std; class Circle { public: Circle(); void set(double r); double get(); double getArea(); private: double radius; }; int main() { Circle cir; return 0; } Circle::Circle() { radius = 0; } void Circle::set(double r) { radius = r; } double Circle::get() { return radius; } double Circle::getArea() { return 3.14*radius*radius; }``````
Ok, so for the second one you need to define another constructor that can take a double.

 ``12345678910111213141516`` ``````class Circle { public: Circle(); Circle(double num); // <-- New constructor definition void set(double r); double get(); double getArea(); private: double radius; }; Circle::Circle(double num) { radius = num; }``````

For the third one you just need to use your get() and getArea() functions.
i dont get it
Topic archived. No new replies allowed.