Question: alter the program below so we create an array of five (5) circle elements. Using a loop, we'll ask the user to input the five

alter the program below so we create an array of five (5) circle elements. Using a loop, we'll ask the user to input the five radii and we'll store those in the array.

Write a method that takes the array as a parameter and displays the diameter, circumference and area.

#include using namespace std; class circle {private: double radius; const static double pi=3.14159; public: circle() {radius=0.0; } circle(double r) {setRadius(r); } void setRadius(double r) {radius=r; } double getRadius() {return radius; } double getArea() {return pi*radius*radius; } double getDiameter() {return radius*2; } double getCircumference() { return 2.*pi*radius; } }; int main() {double r; cout<<"Enter radius: "; cin>>r; circle mycircle(r); cout<<"A circle with radius "<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!