在C++中,如何编写程序来求圆的面积?需要定义长变量PI

来源:百度知道 编辑:UC知道 时间:2024/06/06 18:40:22

const double pi = 3.1415926535897932384626433832795;

这样更好,

#include <iostream>
using namespace std;

double pi = 3.1415926535897932384626433832795;

int main()
{
double r;
cout<<"r = ";
cin>>r;
cout<<"s = ";
cout<<pi*r*r<<endl;
system("PAUSE");
return 0;
}