Ask
your own question, for FREE!
Mathematics
7 Online
OpenStudy (bahrom7893):
What am I doing wrong?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (bahrom7893):
OpenStudy (bahrom7893):
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;
}
OpenStudy (bahrom7893):
I need to get the actual decimals on the screen i'm getting 4.000 3.000 and 3.000
OpenStudy (anonymous):
use float maybe it can help
OpenStudy (bahrom7893):
I tried float.. let me try again..
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (bahrom7893):
nope, same thing
OpenStudy (bahrom7893):
actually let me rewrite the whole thing..
OpenStudy (bahrom7893):
Not working.. =/
OpenStudy (anonymous):
try changing setprecision number
Can't find your answer?
Make a FREE account and ask your own questions, OR help others and earn volunteer hours!
Join our real-time social learning platform and learn together with your friends!
Latest Questions
Mari103:
CLOSED.
8 hours ago
3 Replies
0 Medals
clllaaaaaire:
CLOSED
2 weeks ago
0 Replies
0 Medals