Answer:
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double piValue() {
double p = 1;
int i = 1;
while(true) {
double prev = p;
p += pow(-1, i) * (1.0 / (1 + 2*i));
if(abs(prev - p) < 0.00005) {
break;
}
i++;
}
return 4*p;
}
int main() {
cout << piValue() << endl;
}
**************************************************