C Program to Draw a Triangle using Graphics Function.
⦁ InitGraph initializes the graphics system by loading a graphics driver from disk then putting the system into graphics mode
⦁ closegraph( ) function switches back the screen from graphics mode to text mode.
--------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main( )
{
int gd = DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
line(300,100,200,200);
line(300,100,400,200);
line(200,200,400,200);
getch( );
closegraph( );
}
--------------------------------------------------------------------------------------------------------------------------
Output
--------------------------------------------------------------------------------------------------------------------------
Displays Triangle
EmoticonEmoticon