Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; class Circle { public: double pi; double radius; public: Circle(){ pi = 3.14159; radius = 1.0; } void setRadius(double r){
#include#include using namespace std; class Circle { public: double pi; double radius; public: Circle(){ pi = 3.14159; radius = 1.0; } void setRadius(double r){ radius = r; } double getRadius(){ return radius; } double getArea(){ return pi*radius*radius; } }; int main() { int r; cout<<"Enter radius: "; cin>>r; Circle c; c.setRadius(r); cout<<"Area = "< In C++ add a default constructor to the Circle class in source code above. The constructor should initialize the radius member to 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started