#include "stdafx.h"
#include <iostream>
using namespace std;
#define Pi 3.14159265
class circle
{
public:
double area(double x)
{return Pi*x*x;} //area
double circumfer(double y)
{
return 2*Pi*y;
}
public:
double radius;
};
int _tmain(int argc, _TCHAR* argv[])
{
circle _circle;
cout<<"请输入圆的半径:";
cin>>_circle.radius;
cout<<"圆的面积为:"<<_circle.area(_circle.radius)<<endl;
cout<<"圆的周长为:"<<_circle.circumfer(_circle.radius)<<endl;
getchar();
getchar();
return 0;
}
7-112 求圆的面积和周长
最新推荐文章于 2022-10-02 23:33:59 发布