Im trying to solve this pi using the Leibnitz formula,the input of the program will be the number of terms in the series that user want to sum up and the output of the program will be the summation of those terms.
I cant figure out whats wrong I keep getting and error message about pow being ambiguous.If anyone could point me in the right direction that would be most appreciated. Thanks in advance!
#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
int main() {
longint terms, count;
longdouble pi=0;
cout << "Enter the number of terms to use: " << endl;
cin >> terms;
for (count=1; count<=terms; count++)
{
pi += pow(-1,count+1)/(2*count-1);
}
pi= pi* 4;
cout << "The value of pi based on the number of terms is:" << pi << endl;
return 0;
} // end main