C++控制台实例——计算圆的直径,周长,面积

图片[1]-C++控制台实例——计算圆的直径,周长,面积-云港网络

//计算圆的直径,周长,面积
#include <iostream>
using namespace std;
int main()
{
	float r;
	float pi = 3.14159;
	cout << "请输入圆的半径(R):";
	cin >> r;
	float zj = 2 * r;
	float zc = 2 * pi * r;
	float mj = pi * r * r;
	cout << "圆的直径为:";
	printf("%.4f ", zj);
	cout << endl;
	cout << "圆的周长为:";
	printf("%.4f", zc);
	cout << endl;
	cout << "圆的面积为:";
	printf("%.4f", mj);
	cout << endl;
}
© 版权声明
THE END
喜欢就支持一下吧
点赞4.3W+ 分享
相关推荐
评论 抢沙发

请登录后发表评论

    暂无评论内容