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
We have to write a program to calculate pi, and i realy have no idea where to start. any ideas would be great.
Well how do you calculate pi on paper? What do you do?
You can start by defineing Pi.Quote:
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
i wouldn'y define pi cause you want to calculate pi in the end
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.
....finally someone posts with something intelligent (WarBaboon). No offense everyone else :)