0% found this document useful (0 votes)
58 views2 pages

Practical No-3 CG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

Practical No-3 CG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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