First Turbo Graphics Program in C Language

First Turbo Graphics Program in C Language.

InitGraph initializes the graphics system by loading a graphics driver from disk then putting the system into graphics mode.

  void far initgraph(int far *graphdriver, int far *graphmode, char far   *pathtodriver);

*graphdriver - Integer that specifies the graphics driver to be used.

*graphmode - Integer that specifies the initial graphics mode.

*pathtodriver - Specifies the directory path where initgraph looks for graphics drivers(*.BGI) first.

closegraph( ) function switches back the screen from graphics mode to text mode.

--------------------------------------------------------------------------------------------------------------------------

#include<graphics.h>
#include<conio.h>
void main( )
{
   int gd = DETECT, gm;
   initgraph(&gd, &gm, "c:\\tc\\bgi");
   circle(300,300,50);
   getch( );
   closegraph( );
}



Explanation

--------------------------------------------------------------------------------------------------------------------------

Requirements to Run Program

Graphics.h header file, Graphics.lib library file, Graphics driver(BGI file)



EmoticonEmoticon