#define _USE_MATH_DEFINES
#include
using namespace std;
struct cylinder {
double r;
double h;
double sb;
double v;
cylinder() : r(0), h(0), sb(0), v(0) { };
cylinder(double _r, double _h) : r(_r), h(_h) { };
double area_sb();
double volume();
};
int main () {
locale::global(locale(""));
cout << "Введите радиус: ";
double r;
cin >> r;
cout << "Введите высоту: ";
double h;
cin >> h;
cylinder c(r, h);
cout << "Объём цилиндра = " << c.volume() << endl
<< "Площадь боковой поверхности = " << c.area_sb() << endl;
cin.get(); cin.get();
return 0;
}
double cylinder::area_sb() {
sb = 2 * M_PI * r * h;
return sb;
}
double cylinder::volume() {
v = M_PI * r * r * h;
return v;
}