#include<iostream>
using namespace std;
const double PI=3.14;
class clinder
{
public:
clinder(double radius,double high )
{
r=radius;
h=high;
}
double getradius()
{return r;
}
double gethigh()
{
return h;
}
double vol()
{return PI*r*r*h;
}
void display();
private:
double r,h;
};
void clinder::display()
{
cout<<"圆柱底面半径是:"<<r<<endl;
cout<<"圆柱的高是:"<<h<<endl;
cout<<"圆柱的体积是:"<<vol()<<endl;
}
int main()
{
clinder r1(6,8);
cout<<"圆柱的相关信息是:"<<endl;
r1.display();
return 0;
}
using namespace std;
const double PI=3.14;
class clinder
{
public:
clinder(double radius,double high )
{
r=radius;
h=high;
}
double getradius()
{return r;
}
double gethigh()
{
return h;
}
double vol()
{return PI*r*r*h;
}
void display();
private:
double r,h;
};
void clinder::display()
{
cout<<"圆柱底面半径是:"<<r<<endl;
cout<<"圆柱的高是:"<<h<<endl;
cout<<"圆柱的体积是:"<<vol()<<endl;
}
int main()
{
clinder r1(6,8);
cout<<"圆柱的相关信息是:"<<endl;
r1.display();
return 0;
}