Please plz plz i need help

Pages: 12
Mar 15, 2013 at 4:19am
zereo do you have a problem with me ?!!?!! ...relax...dear.
..it's written on C++ Book pearsn...and i cant use what he gave me because it my 3rd week i c++ so im not bill gates to use for and pow because i dont know it. All what i was want some ideas to not copy and patse codes...!! anw sry dear :)...!
double pi=0.0 i
int N,
int d=1;
int i=1:
cout<< "enter num of terms":
cin>>N
while(i<=N)
{ (if i%2==1)
pi+=4.0/d:
else pi-=4.0/d;
d+=2
i++;
}
Last edited on Mar 15, 2013 at 4:22am
Mar 15, 2013 at 10:50am
This page explains both the while loop and the for loop, with examples. These can be considered some of the basic building blocks of any program, so its worth getting familiar with these ideas before returning to the original question.
http://www.cplusplus.com/doc/tutorial/control/
Mar 15, 2013 at 6:42pm
@TheIdeasMan

Many Thanks for your reflections.
I'm at the beginning of C++ programming.
So any idea is good for me from which I can learn new things.

Mar 16, 2013 at 12:51pm
@abzksm

Also the Leibniz method for calculating PI does not converge very well - so you need a lot of terms to get relatively few decimal places. That is why it didn't seem to work when you ran the code the first time.

Hope all goes well.
Mar 17, 2013 at 3:24am
If you can't do something with your current level of understanding keep learning and try later.
Topic archived. No new replies allowed.
Pages: 12