Professional Documents
Culture Documents
cs201....... 3
cs201....... 3
# include <iostream>
# define PI 3.14159265
class Circle
private:
double radius;
public:
void setRadius();
void computeAreaCirc();
Circle();
~Circle();
};
Circle::Circle()
radius = 0.0;
void Circle::setRadius()
radius = 5.6;
void Circle::computeAreaCirc()
cout << "Area of circle is: " << PI * (radius * radius) << endl;
cout << "Circumference of circle is: " << 2 * PI * radius << endl;
Circle::~Circle()
{
}
class Rectangle
Private:
Double length;
Double width;
Public:
Void setLength();
Void setWidth();
Void computeArea();
Rectangle();
~Rectangle();
};
Rectangle∷Rectangle()
{
Length = 0.0;
Width = 0.0;
Void Rectangle∷setLength()
Length = 5.0;
Void Rectangle∷setWidth()
Width = 4.0;
Void Rectangle∷computeArea()
}
Rectangle∷~Rectangle()
Main()
Int run = 1;
Cout≪”\t\t*******************SCIENTIFIC CALCAULATOR*******************”≪endl;
Cout≪”\t\t*******************BC1234567890*******************”≪endl;
While(run)
Cout ≪ “\nOPTION 1 for computing Area and Circumference of the circle” ≪ endl;
If(option == “1”)
Circle nCircle;
nCircle.setRadius();
nCircle.computeAreaCirc();
cin ≫ choice;
Continue;
Else
{
Break;
Rectangle nRectangle;
nRectangle.setLength();
nRectangle.setWidth();
nRectangle.computeArea();
cin ≫ choice;
Continue;
}
Else
Break;
Else