We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.

Printable View

- 11-05-2002uniqueusernameschool 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-2002kermi3
Well how do you calculate pi on paper? What do you do?

- 11-05-2002Stoned_Coder
- 11-05-2002correlcjHello!Quote:

We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.

Code:

#include<iostream>

using namespace std;

define PI 3.14159

int main()

{

// stuff

return 0;

}

later

cj - 11-05-2002kermi3
i wouldn'y define pi cause you want to calculate pi in the end

- 11-05-2002golfinguy4
1) Pick an algorithm that you want to use to calculate PI.

2) Implement that algorithm - 11-05-2002WarBaboon
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-2002Leeman_s
....finally someone posts with something intelligent (WarBaboon). No offense everyone else :)