Q:

Want to calculate 18 digits but will only calculate to 6? Using long double but still won't work

I've written a program to estimate pi using the Gregory Leibniz formula, however, it will not calculate to 18 decimal points.  It will only calculate up to 5 decimal points. Any suggestions?

A:

Use
cout.precision(50);

To increase the precision of the printed output. Here 50 is the number of decimal digits in your output.

