What am I doing wrong?
Here's the code: #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { double app1 = 4; double app2 = 4-4/3+4/5; double app3 = 4-4/3+4/5-4/7+4/9; cout << "Pi approximations:" <<endl; cout << "1st approximation: " << fixed << setprecision(3) << app1 << endl; cout << "2nd approximation: " << fixed << setprecision(3) << app2 << endl; cout << "3rd approximation: " << fixed << setprecision(3) << app3 << endl; system("pause"); return 0; }
I need to get the actual decimals on the screen i'm getting 4.000 3.000 and 3.000
use float maybe it can help
I tried float.. let me try again..
nope, same thing
actually let me rewrite the whole thing..
Not working.. =/
try changing setprecision number
Join our real-time social learning platform and learn together with your friends!