C++ 计算几何的体积
#include <iostream>
#include <cmath>
using namespace std;
void V_Cuboid(); //计算长方体的体积
void V_Cyblinder(); //计算圆柱体的体积
void V_Cone(); //计算圆锥体的体积
void V_Cuboid()
{
//输入长宽高
double length, width, height;
cout << "请输入长宽高:";
cin >> length >> width >> height;
//计算体积
double v = length * width * height;
//结果保留两位小数
cout.setf(ios::fixed);
cout << setprecision(2);
//cout<<fixed<<setprecision(2);
cout << "长方体的体积为:" << v << endl;
}
void V_Cyblinder()
{
//输入半径、高
const double pi = 3.14;
double radius, height;
cout << "请输入半径、高:";
cin >> radius >> height;
//计算体积
double v = pi * pow(radius,2) * height;
//结果保留两位小数
cout.setf(ios::fixed);
cout << setprecision(2);
//cout<<fixed<<setprecision(2);
cout << "长方体的体积为:" << v << endl;
}
void V_Cone()
{
//输入半径、高
const double pi = 3.14;
double radius, height;
cout << "请输入半径、