To use the graphics routine for borland C++ 5.02 you need to create a project with a Target Type of Application, Platform of DOS, and include the BGI libraries. You can then run a sample application like this:
example:
#include <iostream.h> //console i/o needed if graphics fails
#include <graphics.h>
#include <conio.h>
int main(){
int gDriver = DETECT, gMode = NULL, errorCode;
int right, left;
int top, bottom;
int count;
//initialize graphics mode set driver to autodetect
//3rd param will search current dir for *.bgi files
initgraph(&gDriver, &gMode, ""

;
//check result of graphics initialization
errorCode = graphresult();
//if anything other than succesful show error code and end program
if(errorCode != grOk){
cout<<"Graphics error : "<<grapherrormsg(errorCode)<<endl;
cout<<"Press any key to exit..."<<endl;
getch();
return 1;
}
//set line style solid and with a thickness of 3 pixels
setlinestyle(SOLID_LINE, NULL, 3);
//initialize the rectangle values
left = getx() + 10;
top = gety() + 10;
right = getmaxx() - 10;
bottom = getmaxy() - 10;
//initialize loop control variable
count = 1;
while(count <= getmaxcolor()){
//change color of rectangle
setcolor(count);
rectangle(left, top, right, bottom);
//change rectangle values to embed smaller rectangles in larger
left = left + 10;
top = top + 10;
right = right - 10;
bottom = bottom - 10;
//update loop control variable
count++;
}
//pause output press any key to exit program
getch();
//close graphics mode
closegraph();
return 0;
}
For the initgraph() function to initialize correctly make sure you copy *.bgi files from c:\bc5\bgi to whatever your current directory is.
hope this helps.
happy programming!