за borlandC
Code:
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
#include<stdio.h>

void MinMax(int m, double a[], double &min, double &max)
{
	min = a[0];
	max = a[0];
	for(int i=1; i<m; i++)
	{
		if(a[i]<min) min=a[i];
		if(a[i]>max) max=a[i];
	}
}

double Axis(int d, int p, int del, double min, double max, int x0, int y0)
{
	char buf[30];
	int dx=p/del;
	double s=((max - min)/p);
	setcolor(11);
	if(d==0)
	{
		line(x0, y0, (x0+p), y0);
		for(int i=1; i<del; i++)
		{
		line((x0+i*dx), y0, (x0+i*dx), (y0+3));
		sprintf(buf, "%.2f", (min+i*dx*s));
		outtextxy((x0+i*dx), y0+10, buf);
		}
	}
	  else
	  {
	  line(x0, y0, x0, (y0-p));
	  for(int i=del; i>0; i--)
		{
		line(x0, (y0-i*dx), (x0-3), (y0-i*dx));
		settextjustify(2,1);
		sprintf(buf, "%.2f", (min+i*dx*s));
		outtextxy((x0-10),(y0-i*dx), buf);
		}
	  }
	  return s;
}

void Points(int n, double xp[], double yp[], int x0, int y0, int minX, int minY, double sx, double sy, int sp)
{
	 setcolor(12);
	 for(int i=0; i<n; i++)
	 switch(sp)
	 {
	 case 0:
	 putpixel((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy),3); break;
	 case 1:
	 circle((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy),2); break;
	 case 2:
		 {
		 line((x0+(xp[i]-minX)/sx)+3, (y0-(yp[i]-minY)/sy)-3, (x0+(xp[i]-minX)/sx)-3, (y0-(yp[i]-minY)/sy)+3);
		 line((x0+(xp[i]-minX)/sx)-3, (y0-(yp[i]-minY)/sy)-3, (x0+(xp[i]-minX)/sx)+3, (y0-(yp[i]-minY)/sy)+3);
		 } break;
	 case 3:
		 {
		 line((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy)+2, (x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy)-2);
		 line((x0+(xp[i]-minX)/sx)-2, (y0-(yp[i]-minY)/sy), (x0+(xp[i]-minX)/sx)+2, (y0-(yp[i]-minY)/sy));
		 } break;
		 }
}
void CurveBezie(double masX[], double masY[], double masRx[], double masRy[], double masQx[], double masQy[], int m)
{
	 int n;
	 for(double t=0; t<1; t+=0.01)
	 {
	 for(int i=0; i<m; i++)
		 {
		 masRx[i]=masX[i];
		 masRy[i]=masY[i];
		 }
	 n=m;
	 while(n>0)
		 {
		 for(i=0; i<n-1;i++)
			 {
			 masQx[i]=masRx[i]+(masRx[i+1]-masRx[i])*t;
			 masQy[i]=masRy[i]+(masRy[i+1]-masRy[i])*t;
			 }
		 n=n-1;
		 for(i=0;i<n;i++)
			 {
			 masRx[i]=masQx[i];
			 masRy[i]=masQy[i];
			 }
		 }
	 putpixel(masRx[0], masRy[0], 10);
	}
}
void main()
{
	 clrscr();
	 int gdriver=0, gmode;
	 const int n=6;
	 int x0=50;
	 int y0=400;
	 double masY[]={2.4, 3.1, 0, 1.7, 0.2, 1.5};
	 double masX[]={8.00, 8.50, 9.00, 9.50, 10.00, 10.50};
	 double masPx[6];
	 double masPy[6];
	 double masRx[6];
	 double masRy[6];
	 double masQx[6];
	 double masQy[6];
	 double minX, maxX, minY, maxY;
	 MinMax(n, masX, minX, maxX);
	 MinMax(n, masY, minY, maxY);
	 initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi");
	 double sx, sy;
	 sx = Axis(0, 400, 8, minX, maxX, x0, y0);
	 sy = Axis(1, 300, 8, minY, maxY, x0, y0);
	 for(int i = 0 ; i < 6; i ++)
	 {
		 masPx[i] = 50 + (masX[i]-minX)/sx;
		 masPy[i] = 400 - (masY[i]-minY)/sy;
	 }
	 Points(6, masX, masY, x0, y0, minX, minY, sx, sy,  2);
	 setcolor(4);
 	 CurveBezie(masPx, masPy, masRx, masRy, masQx, masQy, 6);

	 getche();
	 closegraph();
}


за codeblocks
Code:
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
#include<stdio.h>

void MinMax(int m, double a[], double &min, double &max)
{
	min = a[0];
	max = a[0];
	for(int i=1; i<m; i++)
	{
		if(a[i]<min) min=a[i];
		if(a[i]>max) max=a[i];
	}
}

double Axis(int d, int p, int del, double min, double max, int x0, int y0)
{
	char buf[30];
	int dx=p/del;
	double s=((max - min)/p);
	setcolor(11);
	if(d==0)
	{
		line(x0, y0, (x0+p), y0);
		for(int i=1; i<del; i++)
		{
		line((x0+i*dx), y0, (x0+i*dx), (y0+3));
		sprintf(buf, "%.2f", (min+i*dx*s));
		outtextxy((x0+i*dx), y0+10, buf);
		}
	}
	  else
	  {
	  line(x0, y0, x0, (y0-p));
	  for(int i=del; i>0; i--)
		{
		line(x0, (y0-i*dx), (x0-3), (y0-i*dx));
		settextjustify(2,1);
		sprintf(buf, "%.2f", (min+i*dx*s));
		outtextxy((x0-10),(y0-i*dx), buf);
		}
	  }
	  return s;
}

void Points(int n, double xp[], double yp[], int x0, int y0, int minX, int minY, double sx, double sy, int sp)
{
	 setcolor(12);
	 for(int i=0; i<n; i++)
	 switch(sp)
	 {
	 case 0:
	 putpixel((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy),3); break;
	 case 1:
	 circle((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy),2); break;
	 case 2:
		 {
		 line((x0+(xp[i]-minX)/sx)+3, (y0-(yp[i]-minY)/sy)-3, (x0+(xp[i]-minX)/sx)-3, (y0-(yp[i]-minY)/sy)+3);
		 line((x0+(xp[i]-minX)/sx)-3, (y0-(yp[i]-minY)/sy)-3, (x0+(xp[i]-minX)/sx)+3, (y0-(yp[i]-minY)/sy)+3);
		 } break;
	 case 3:
		 {
		 line((x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy)+2, (x0+(xp[i]-minX)/sx), (y0-(yp[i]-minY)/sy)-2);
		 line((x0+(xp[i]-minX)/sx)-2, (y0-(yp[i]-minY)/sy), (x0+(xp[i]-minX)/sx)+2, (y0-(yp[i]-minY)/sy));
		 } break;
		 }
}
void CurveBezie(double masX[], double masY[], double masRx[], double masRy[], double masQx[], double masQy[], int m)
{
	 int n;
	 for(double t=0; t<1; t+=0.01)
	 {
	 for(int i=0; i<m; i++)
		 {
		 masRx[i]=masX[i];
		 masRy[i]=masY[i];
		 }
	 n=m;
	 while(n>0)
		 {
		 for(int i=0; i<n-1;i++)
			 {
			 masQx[i]=masRx[i]+(masRx[i+1]-masRx[i])*t;
			 masQy[i]=masRy[i]+(masRy[i+1]-masRy[i])*t;
			 }
		 n=n-1;
		 for(int i=0;i<n;i++)
			 {
			 masRx[i]=masQx[i];
			 masRy[i]=masQy[i];
			 }
		 }
	 putpixel(masRx[0], masRy[0], 10);
	}
}
int main()
{
//	 clrscr();
	 int gdriver=0, gmode;
	 const int n=6;
	 int x0=50;
	 int y0=400;
	 double masY[]={2.4, 3.1, 0, 1.7, 0.2, 1.5};
	 double masX[]={8.00, 8.50, 9.00, 9.50, 10.00, 10.50};
	 double masPx[6];
	 double masPy[6];
	 double masRx[6];
	 double masRy[6];
	 double masQx[6];
	 double masQy[6];
	 double minX, maxX, minY, maxY;
	 MinMax(n, masX, minX, maxX);
	 MinMax(n, masY, minY, maxY);
	 //initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi");
	   initgraph(&gdriver, &gmode, "C:/Program Files/CodeBlocks/EGAVGA.BGI");
	 double sx, sy;
	 sx = Axis(0, 400, 8, minX, maxX, x0, y0);
	 sy = Axis(1, 300, 8, minY, maxY, x0, y0);
	 for(int i = 0 ; i < 6; i ++)
	 {
		 masPx[i] = 50 + (masX[i]-minX)/sx;
		 masPy[i] = 400 - (masY[i]-minY)/sy;
	 }
	 Points(6, masX, masY, x0, y0, minX, minY, sx, sy,  2);
	 setcolor(4);
 	 CurveBezie(masPx, masPy, masRx, masRy, masQx, masQy, 6);

	 getche();
	 closegraph();
	 return 0;
}