On line 7 of my code I declared a constant in the global scope called pi. I then later tried to use it in my function called circleArea that i defined on line 59. when entering my constant pi, an error popped up that told me Error: expression must have(pointer-to-) function type. can somebody please tell me what this means, and how to fix it? Thank you.
#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
constdouble pi = 3.1415926535897932384626433832795;
void circleArea(double&);
// circleArea - Calculates the area of a circle that the user enters the radius of.
// @param double& - This is the radius that the user enters.
int main() {
cout << fixed << showpoint << setprecision(10);
cout << "GEOMETRICAL CALCULATOR." << endl << endl;
while(true) {
cout << "1.Area of a Circle\n" <<
"2.Hypotenuse of a Triangle\n" <<
"3.Base length of a Triangle\n" <<
"4.Quit\n" <<
"What would you like to do? ";
shortint choice;
cin >> choice;
if(choice == 4)
break;
elseif(choice < 1)
break;
elseif(choice > 4)
break;
double value1,
value2;
if(choice == 1) {
}
elseif(choice == 2) {
}
elseif(choice == 3) {
}
elsebreak;
}
cout << "\n\n\nPROGRAM ENDED\n\n\n";
system("pause");
return 0;
}
void circleArea(double& value1) {
cout << "The area of a circle with a radius of " << value1 << "is: " << (pi(pow(value1, 2)));
}
pi(pow(value1, 2)) means "call the function pi passing pow(value1, 2) as the first parameter", not "multiply the value of pi by pow(value1, 2)". * is the non-optional multiplication operator: pi * pow(value1, 2)