Here is the code

Code:

int fact(double i)
{
if (i<=1) return 1;
else return i*fact(i-1);
}
int nCi(double i)
{
return fact(degrees)/(fact(degrees-i)*fact(i));
}
double bu(double i,double u)
{
return nCi(i)*pow(1-u,degrees-1)*pow(u,i);
}
void C(double u, double Pt[3])
{
for (int k=0; k<3; k++)
{
Pt[k]=0.0;
for (int i=0; i<degrees+1; i++)
{
Pt[k]+=bu(i,u)*controlpoint[i][k];
}
}
}
void calc_bezier_pts()
{
double u;
for (int i=0;i<number;i++)
{
u=(i)/(number-1);
C(u, bezier_curve[i]);
}
}
int draw_bez()
{
calc_bezier_pts();
for (int i=0;i<number;i++)
{
draw_line(bezier_curve[i][0],bezier_curve[i][1],bezier_curve[i+1][0],bezier_curve[i+1][1],9);
}
return 1;
}

and here are the variables functions etc...

Code:

int controlpoints();
int translate();
int clearscreen();
int replot();
int scale();
int fact(int i);
int nCi(int n, int i);
double bu(int i,double u);
void C(double u, double Pt[3]);
void calc_bezier_pts();
int draw_bez();
int degrees=3;
double controlpoint[8][3]={{0,350,0},{250,350,0},{300,100,0},{350,500,0},{400,200,0},{450,450,0},{500,350,0},{650,350,0}};
double controlpointT[8][3];
double translation[3];
int handle;
double scalingfactor;
int a=1;
int b=0;
const int number=1000;
double bezier_curve[number][3];

I would post the entire code but i know other people from my uni course look at this forum and i dont want someone to cut/paste my whole programme and hand it in as their own.

Cheers for all the help though everyone.