C++控制符的使用
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double r,h;
cout << "请输入半径,高度:";
cin >> r >> h;
double c, s_yuan, s_yuanqiu, v_yuanqiu, v_yuanzhu;
c = 2 * 3.14 * r;
s_yuan = 3.14 * r * r;
s_yuanqiu = 4 * 3.14 * r * r;
v_yuanqiu = 3.0 / 4.0 * 3.14 * r * r * r;
v_yuanzhu = s_yuan * h;
cout << "圆周长:" << setiosflags(ios::fixed) << setprecision(2) << c << endl;
cout << "圆面积:" << setiosflags(ios::fixed) << setprecision(2) << s_yuan << endl;
cout << "圆球面积:" << setiosflags(ios::fixed) << setprecision(2) << s_yuanqiu << endl;
cout << "圆球体积:" << setiosflags(ios::fixed) << setprecision(2) << v_yuanqiu << endl;
cout << "圆柱体积:" << setiosflags(ios::fixed) << setprecision(2) << v_yuanzhu << endl;
return 0;
}