You are on page 1of 2

Practical No.

-3

AIM: To draw a line, triangle and circle using functions of graphics.h header
file
LINE:

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

main()
{
int gd = DETECT, gm;

initgraph(&gd, &gm, "C:\\TC\\BGI");

line(100, 100, 200, 200);

getch();
closegraph();
return 0;
}

TRAINGLE:

#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);

www.ahirlabs.com 1
getch();
closegraph();
}

CIRCLE:

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

int main(){
int gd = DETECT,gm;
int x ,y ,radius=80;
initgraph(&gd, &gm, "C:\\TC\\BGI");
x = getmaxx()/2;
y = getmaxy()/2;

outtextxy(x-100, 50, "CIRCLE Using Graphics in C");


circle(x, y, radius);
getch();
closegraph();
return 0;
}

www.ahirlabs.com 2

You might also like