24 lines
536 B
C++
24 lines
536 B
C++
|
#include <iostream>
|
||
|
#include <cmath>
|
||
|
|
||
|
using namespace std;
|
||
|
const float PI = 3.14159;
|
||
|
|
||
|
double Area(double a, double b)
|
||
|
{
|
||
|
return PI * pow(a, 2) * b / 360;
|
||
|
}
|
||
|
double Area(double a)
|
||
|
{
|
||
|
return PI * pow(a, 2);
|
||
|
}
|
||
|
|
||
|
int main(int argc, char const *argv[])
|
||
|
{
|
||
|
double r, x;
|
||
|
cout << "请输入半径和角度: " << endl;
|
||
|
cin >> r >> x;
|
||
|
cout << "半径为 " << r << ", 角度为 " << x << " 的扇形面积为: " << Area(r, x) << endl;
|
||
|
cout << "半径为 " << r << ", 的圆的面积为: " << Area(r) << endl;
|
||
|
return 0;
|
||
|
}
|