0% found this document useful (0 votes)
61 views3 pages

1

cg lab

Uploaded by

Sindu Rangaswamy
Copyright
© Attribution Non-Commercial (BY-NC)
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)
61 views3 pages

1

cg lab

Uploaded by

Sindu Rangaswamy
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

OUTPUT PRIMITIVES Aim: To write a C Program to display the output primitives.

Algorithm: 1. 2. 3. 4. 5. 6. 7. 8. 9.

Start the program . Initialize the variables. Call the initgraph() function Set color for the output primitives. Using Outtextxy() display the choosen particular primitives. Using switch case mention the various primitives and their attributes. The various primitives are arc, line ,circle, rectangle and ellipse. close the graph and run the program. stop the program.

PROGRAM:

#include<stdio.h> #include<conio.h> #include<graphics.h> #include<string.h> void main() { char ch='y'; int gd=DETECT,gm,x1,y1,x2,y2,rad,sa,ea,xrad,yrad,i; initgraph(&gd,&gm,""); while(ch=='y') { cleardevice(); setbkcolor(9); outtextxy(100,150,"Enter 1 to get line"); outtextxy(100,170,"2.Circle"); outtextxy(100,190,"3.Box"); outtextxy(100,210,"4.Arc"); outtextxy(100,230,"5.Ellipse"); outtextxy(100,250,"6.Rectangle"); outtextxy(100,270,"7.Exit"); ch=getch(); cleardevice(); switch(ch) { case '1': line(100,200,300,400); break; case '2':

t t h

/ : p

s c /

u t e

. e b

/ k t

http://csetube.weebly.com/

circle(200,200,100); break; case '3': setfillstyle(5,4); bar(100,300,200,100); break; case '4': setfillstyle(5,4); arc(200,200,100,300,100); break; case '5': setfillstyle(5,4); fillellipse(100,100,50,100); break; case '6': settextstyle(DEFAULT_FONT,0,2); outtextxy(120,140,"VEL TECH"); line(100,100,100,300); line(300,300,100,300); line(100,100,300,100); line(300,100,300,300); break; case '7': closegraph(); return; } ch='y'; getch(); } } Output:

t t h

/ : p

s c /

u t e

. e b

/ k t

http://csetube.weebly.com/

t t h

/ : p

s c /

u t e

. e b

/ k t

Result: Thus the program is executed successfully.

http://csetube.weebly.com/

You might also like