Approximating PI using the Taylor Series - Help!
Hey. I want to write a program that approximates the value of PI using the Taylor Series. This is the program I've written so far but I'm not sure how to complete the FOR loop. Someone please help.
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Piapproximation\n"
"Welcome to my version of Piapproximation\n";
//declaring variables
int terms;
double pi = 0.0;
//getting input from user
cout<<"\nEnter the number of terms: ";
cin>> terms;
//loop to calculate the value of pi
for (long int i = 1; i <= terms; i ++)
...
//output
cout<<"\nThe approximation of PI is: "<< pi <<
"\n\nThank you!\n";
system("PAUSE");
return EXIT_SUCCESS;
}