title: Calculating Pi with Taylor Method C++
body: <p>Google has just sent me in a round robin. My instructions are:</p>
  <blockquote>
  <p>An approximate value of pi can be calculated using the series given below:</p>
  <p>pi = 4 * [ 1 - 1/3 + 1/5 - 1/7 + 1/9 … + ((-1)^n)/(2n + 1) ]</p>
  <p>write a C++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the number of terms in the approximation of the value of pi and outputs the approximation. Include a loop that allows the user to repeat this calculation for new values n until the user says she or he wants to end the program.</p>
  </blockquote>
  <p>I never took calculus though so this is over my head and I don't know how to accomplish what I'm being asked.</p>
  <pre><code>#include&lt;iostream&gt;
  #include&lt;iomanip&gt;
  #include&lt;cmath&gt;
  #include&lt;math.h&gt;
  
  using namespace std;
  
  int main()  
  
  {
      //declare variables
      double sum, pi;
      int n;
      
      //prompt user
      cout &lt;&lt; &quot;How many decimals would you like to calculate pi to? &quot;;
      cin &gt;&gt; n;
      
      //calculate pi
      
      //print response
      cout &lt;&lt; fixed &lt;&lt; setprecision (n) &lt;&lt; pi &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  <p>The cmath and math.h are leftover from attempts to make what I was given work properly and it solved a few of my errors but I know I really need to do more. I assume I need loops somehow since that's where I am in class but I don't know WHAT to loop. How should I implement the series?</p>
  <p>I know y'all frown on homework help that's this lost so if you could just point me in the right direction I'll do my best. Thanks!</p>