Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> #include <cmath> using namespace std; int main() { double to

ID: 3797339 • Letter: #

Question

  

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

double total =0;

int entry;

cout << "Please input your n value for pi approximation " << endl;

cin >>entry;

for (int i=0; i <entry; i++)

total +=(pow(-1,i))/(2*i+1);

total *= 4;// you have only calulated thesequence inside the brackets. hav$

cout << "This approximation leads to an answer of " << total;

cout << " ";

return (0);

}

How do i make this program ask the user if they want to repeat it or close the program. Please fix the code.

Explanation / Answer

Hi, I modified the code . Now, it will be user friendly to continue again or terminate it

Code: