在第23行,它说表达式不能用作函数。我不明白它的意思。我不确定它要我改变什么,需要一些帮助。起初我以为可能是我的头文件中预定义的M_PI常量,我将其更改为PI并直接在代码中定义,但这并没有起作用。
#include "std_lib_facilities_4.h"
int main() {
const double PI = 3.141592653589793238463;
//formula for area of a circle is pi*r^2
//area of a 14" circle is 153.94"
cout << "Enter cord length in inches: \n\n";
double chord_length;
while(cin >> chord_length) {
double radius = 7.0;
double angle_of_sect = (asin((chord_length / 2.0) / radius)) * 2.0;
double area_of_sect = (angle_of_sect / 360.0(PI * radius));
double area_of_seg = area_of_sect - (((chord_length / 2.0) * radius) * 2.0);
double perc_of_pizza = (100.0 * area_of_seg) / 153.94;
if(chord_length > 14) {
cout << "Chord Length Too Long \n";
} else if(chord_length <= 0) {
cout << "Chord Length Too Small \n";
}
cout << "\nSegment area is equal to: " << perc_of_pizza << ".\n";
}
return 0;
}