Cannot open include file: 'winbgi2.h': No such file or directory

i am using #include "winbgi2.h" in c++. i am using visual studio 2010. the problem is i cant build my code. i dont know how to solve this error and what to do. i am stuck! please help! Here is my code...



#include <stdio.h>
#include <math.h>
#include "winbgi2.h"

//starting:

const int X_SIZE=1000;
const int Y_SIZE=200;
const double xmax=10;
const double xmin=0.1;
const int NOP=400;



double ymax;
double ymin;
double h=(xmax-xmin)/(NOP-1);
int N;
//double R;


void scan(void);
void draw(void);
double aprox(double x, int N);
void draw2(void);
double epsilon(double act,double aprox);
void draw3(void);
double LinIter(double x1,double y1,double x2,double y2,double x);

void main()
{


//scan for the range of y:
scan();

//draw the garphics of the function;
draw();

printf("Please input an N:\n");
scanf("%d",&N);

// "the approximate formula"
draw2();

//draw the epsilon
draw3();

wait();


}


double LinIter(double x1,double y1,double x2,double y2,double x)
{
double a=(y1-y2)/(x1-x2);
double b=y1-a*x1;
return a*x+b;
}

void scan(void)
{
double x;
double y;
ymax=log(0.1);
ymin=log(0.1);
x=xmin;
for(int i=0;i<=NOP;++i)
{
y=log(x);
if (ymax<y)
ymax=y;
if (ymin>y)
ymin=y;

x=x+h;
}

printf("the maximum of y is %lf\nthe minimun of y is %lf \n\n",ymax,ymin);


}

void draw(void)
{
graphics(X_SIZE,Y_SIZE);
double x_pos;
double y_pos;

double x;
double y;

for(int i=0;i<NOP;++i)
{
x=xmin+ i*h;
y=log(x);
x_pos=LinIter(xmin,0.,xmax,X_SIZE,x);
y_pos=LinIter(ymax,0.0,ymin,Y_SIZE,y);
circle(x_pos,y_pos,1);
}

}

double aprox(double x,int N)
{
double R=(x-1.)/(x+1.);
double result=R;
for(int i=2;i<=N;i++)
{
result += 1./3. * pow(R, 2*i-1);
}

return 2.0*result;
}

void draw2(void)
{
double x_pos;
double y_pos;

double x;
double y;

for(int i=0;i<NOP;++i)
{
x=xmin+ i*h;
y=aprox(x,N);
x_pos=LinIter(xmin,0.,xmax,X_SIZE,x);
y_pos=LinIter(ymax,0.0,ymin,Y_SIZE,y);
circle(x_pos,y_pos,1);
}
}

double epsilon(double act,double aprox)
{
return abs(act-aprox);
}

void draw3(void)
{
double x_pos;
double y_pos;

double x;
double y;

for(int i=0;i<NOP;++i)
{
x=xmin+ i*h;
y=epsilon(log(x),aprox(x,N));
x_pos=LinIter(xmin,0.,xmax,X_SIZE,x);
y_pos=LinIter(ymax,0.0,ymin,Y_SIZE,y);
circle(x_pos,y_pos,1);
}

}
You need to find out which directory that file is in, and add it to your include path.
projectsettings -> c/c++ -> additional include directories -> select the folder in which that file is located
Thanks guys, it's working now ;)
Topic archived. No new replies allowed.