# school programming class problem

Printable View

• 11-05-2002
uniqueusername
school programming class problem
We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
• 11-05-2002
kermi3
Well how do you calculate pi on paper? What do you do?
• 11-05-2002
Stoned_Coder
• 11-05-2002
correlcj
Hello!
Quote:

We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
You can start by defineing Pi.
Code:

``` #include<iostream> using namespace std; define PI 3.14159 int main() { // stuff return 0; }```
I hope this helps you get started.
later
cj
• 11-05-2002
kermi3
i wouldn'y define pi cause you want to calculate pi in the end
• 11-05-2002
golfinguy4
1) Pick an algorithm that you want to use to calculate PI.
2) Implement that algorithm
• 11-05-2002
WarBaboon
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.
• 11-05-2002
Leeman_s
....finally someone posts with something intelligent (WarBaboon). No offense everyone else :)