#include<iostream>
#include<cmath>
using namespace std;
#define PI 3.14
class Base{
protected:
double r;
public:
Base(double a=1)
{
r=a;
}
};
class Sphere:public Base{
public:
Sphere(double a=1):Base(a){}
double getSpheres()
{
return 4*PI*r*r;
}
double showSpheres()
{
cout<<"The area of the sphere:"<<getSpheres();
}
};
int main()
{
double a1;
cout<<"Input the radius of the sphere:";
cin>>a1;
Sphere x(a1);
cout<<x.showSpheres()<<endl;
#include<cmath>
using namespace std;
#define PI 3.14
class Base{
protected:
double r;
public:
Base(double a=1)
{
r=a;
}
};
class Sphere:public Base{
public:
Sphere(double a=1):Base(a){}
double getSpheres()
{
return 4*PI*r*r;
}
double showSpheres()
{
cout<<"The area of the sphere:"<<getSpheres();
}
};
int main()
{
double a1;
cout<<"Input the radius of the sphere:";
cin>>a1;
Sphere x(a1);
cout<<x.showSpheres()<<endl;
}