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; }



1Likes
LinkBack URL
About LinkBacks





.It is said that because if you select a random cycle and you calculate the fraction of its regional (=περιφέρεια) to its diameter (=διάμετρος) then you always get the number π.As a result π is said to be derived by the word περιφέρεια. It is also said that Epimarchos (=Επίμαρχος) invented the letter π in greek alphabet,but this is mythology.