We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
You can start by defineing Pi.We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
I hope this helps you get started.Code:#include<iostream> using namespace std; define PI 3.14159 int main() { // stuff return 0; }
later
cj
"Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
-Bruce Lee
1) Pick an algorithm that you want to use to calculate PI.
2) Implement that algorithm
I won't do it for you, but a simple algorithm for Pi calcution is as follows :
Pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 -... you get the idea. Have fun with this Fourier series.
Using Dev-C++ beta under Win XP Pro. That or g++ on Mandrake Linux 9.0 .
....finally someone posts with something intelligent (WarBaboon). No offense everyone else