graphics.h Header File in C Programming

The ‘graphics.h’ header file is used to declare graphics functions. It declares prototypes for the graphics functions.

Some of the standard member functions of graphics.h header files are,
_______________________________________________________________
Function Name	Description
_______________________________________________________________
initgraph -	Used to initilize graphics and load graphics 
		driver.
line 		Used to draw a line as line(x1,y1,x2,y2).
bar -		Used to draw rectangle with diagonal, 
		bar(x1,y1,x2,y2).
circle -	Used to draw circle, circle(x1,y1,radius).
cleardevice -	It clears the graphics screen.
closegraph -	Closes or shut downs graphics system.
rectangle -	Used to draw a rectangle.
setcolor -	It sets the current drawing color.
getcolor -	It returns the current drawing color.
floodfill -	Used to flood-fill bounded region.
settextstyle -	It sets current text features.
ellipse -	It draws ellipse, as 
		ellipse(x,y,start,end,xrad,yrad).
_______________________________________________________________

Program :

/*  Program to demonstrate graphics.h header file working.
Creation Date : 6:12 PM 08/11/2010
Author : www.technoexam.com [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>
#include <graphics.h>

int main(void)
{
	int gdriver=DETECT, gmode;
	clrscr();
	initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
	circle(70,70,20);
	getch();
	closegraph();
	return 0;
}

Output :

Leave A Comment

Your email address will not be published. Required fields are marked *