You are on page 1of 49

Question 1: Explain 20 graphics functions of <graphics.

h> with their decleration ,syntax


and use.

Answer:

1. arc function:

Declaration :- void arc(int x, int y, int stangle, int endangle, int radius); arc function is used to draw an arc with center (x,y) and stangle specifies starting angle, endangle specifies the end angle and last parameter specifies the radius of the arc. arc function can also be used to draw a circle but for that starting angle and end angle should be 0 and 360 respectively.

2. bar function:
Declaration :- void bar(int left, int top, int right, int bottom); Bar function is used to draw a 2-dimensional, rectangular filled in bar . Coordinates of left top and right bottom corner are required to draw the bar. Left specifies the X-coordinate of top left corner, top specifies the Y-coordinate of top left corner, right specifies the Xcoordinate of right bottom corner, bottom specifies the Y-coordinate of right bottom corner.

3.circle:
Declaration :- void circle(int x, int y, int radius); Circle function is used to draw a circle with center (x,y) and third parameter specifies the radius of the circle.

4.closegraph:
closegraph function closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph. Declaration :- void closegraph();

5.drawpoly:
Drawpoly function is used to draw polygons i.e. triangle, rectangle, pentagon, hexagon etc. Declaration :- void drawpoly( int num, int *polypoints );

6.getbkcolor:
getbkcolor function returns the current background color Declaration : int getbkcolor();

e.g. color = getbkcolor(); // color is an int variable if current background color is GREEN then color will be 2.

7.getcolor:
getcolor function returns the current drawing color. Declaration : int getcolor(); e.g. a = getcolor(); // a is an integer variable if current drawing color is WHITE then a will be 15.

8.getimage:
getimage function saves a bit image of specified region into memory, region can be any rectangle. Declaration:- void getimage(int left, int top, int right, int bottom, void *bitmap);

9.getmaxcolor:
getmaxcolor function returns maximum color value for current graphics mode and driver. Total number of colors available for current graphics mode and driver are ( getmaxcolor() + 1 ) as color numbering starts from zero. Declaration :- int getmaxcolor();

10.outtext:
outtext function displays text at current position. Declaration :- void outtext(char *string);

11.putpixel:
putpixel function plots a pixel at location (x, y) of specified color. Declaration :- void putpixel(int x, int y, int color); For example if we want to draw a GREEN color pixel at (35, 45) then we will write putpixel(35, 35, GREEN); in our c program, putpixel function can be used to draw circles, lines and ellipses using various algorithms.

12.imagesize:
imagesize function returns the number of bytes required to store a bitimage. This function is used when we are using getimage. Declaration:- unsigned int imagesize(int left, int top, int right, int bottom);

13.setcolor:
Declaration :- void setcolor(int color); In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc.

14.setbkcolor:
Declaration :- void setbkcolor(int color); setbkcolor function changes current background color e.g. setbkcolor(YELLLOW) changes the current background color to YELLOW. Remember that default drawing color is WHITE and background color is BLACK.

15.setfillstyle:
setfillstyle function sets the current fill pattern and fill color. Declaration :- void setfillstyle( int pattern, int color);

16.setviewport:
setviewport function sets the current viewport for graphics output. Declaration :- void setviewport(int left, int top, int right, int bottom, int clip); setviewport function is used to restrict drawing to a particular portion on the screen. For example setviewport(100 , 100, 200, 200, 1); will restrict our drawing activity inside the rectangle(100,100, 200, 200).

17.textheight:

textheight function returns the height of a string in pixels.

Declaration :- int textheight(char *string);

Question 2: WAP to draw basis shapes(circle,rectangle,ellipse,sector,polygon).


Answer 2: Circle #include<graphics.h> #include<conio.h>

void main() { int gd=DETECT; int gm; clrscr(); initgraph(&gd,&gm,""); circle(100,100,90); getch(); closegraph(); } OUTPUT:

Rectangle
#include<graphics.h> #include<conio.h> void main() { int gd=DETECT;

int gm; clrscr(); initgraph(&gd,&gm,""); rectangle(10,10,200,200); getch(); closegraph(); }


OUTPUT:

Ellipse
#include<stdio.h> #include<dos.h> #include<graphics.h> void ellipsemidpoint(float,float,float,float); void drawellipse(float,float,float,float); void main() {

float xc,yc,rx,ry; int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); printf("\nenter center of ellipse:"); scanf("%f%f",&xc,&yc); printf("\n enter x-radius coordinate"); scanf("%f",&rx); getch(); printf ("\n enter y-radius coordinate"); scanf("%f",&ry); ellipsemidpoint(xc,yc,rx,ry); getch(); } void ellipsemidpoint(float xc,float yc,float rx,float ry) { float rxsq=rx*rx; float rysq=ry*ry; float x=0,y=ry,p; float px=0,py=2*rxsq*y; drawellipse(xc,yc,x,y); //Region 1 p=rysq-(rxsq*ry)+(0.25*rxsq); while(px<py) { x=x+1; px=px+2*rysq; if(p<0) p=p+rysq+px; else

{ y=y-1; py=py-2*rxsq; p=p+rysq+px-py; } drawellipse(xc,yc,x,y); delay(30); } //Region 2 p=rysq*(x+0.5)*(x+0.5)+rxsq*(y-1)-rxsq*rysq; while(y>0) { y=y-1; py=py-2*rxsq; if(p>0) p=p+rxsq-py; else { x++; px=px+2*rysq; p=p+rxsq-py+px; } drawellipse(xc,yc,x,y); delay(30); } } void drawellipse(float xc,float yc,float x,float y) { putpixel(xc+x,yc+y,RED);

putpixel(xc-x,yc+y,RED); putpixel(xc+x,yc-y,RED); putpixel(xc-x,yc-y,RED); } OUTPUT

Sector
#include<graphics.h> #include<conio.h> void main() { int gd=DETECT,gm; initgraph(&gd,&gm,""); // setcolor(GREEN); sector(100,100,0,135,25,35); getch(); closegraph(); } OUTPUT

Question3: WAP to draw a line using DDA algorithm. Answer :


#include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> void main() { int gd=DETECT,gm; int dx,dy,x,y,x1,y1,x2,y2,p; clrscr(); initgraph(&gd,&gm,"c:\\tc\\bgi"); printf("\n\n\t enter the co-ordinate of first point:"); scanf("%d%d",&x1,&y1); printf("\n\n\t enter co-ordinate of second point:");

scanf("%d%d",&x2,&y2); dx=(x2-x1); dy=(y2-y1); p=2*(dy)-(dx); x=x1; y=y1; putpixel(x,y,WHITE); while(x<=x2) { if(p<0) { x=x+1; y=y; p=p+2*(dy); } else { x=x+1; y=y+1; p=p+2*(dy-dx); } putpixel(x,y,WHITE); } getch(); closegraph(); } OUTPUT

Question 4: WAP to draw a line using breshnam's algorithm. Answer:


#include<graphics.h> #include<stdio.h> #include<conio.h> #include<math.h> void main() { int gd=DETECT,gm; int x,y,x1,y1,x2,y2,dx,dy,p; clrscr(); initgraph(&gd,&gm,""); printf("\n\n\t Enter the first coordinate"); scanf("%d%d",&x1,&y1); printf("\n\n\t Enter the second coordinate"); scanf("%d%d",&x2,&y2); dx=(x2-x1); dy=(y2-y1); p=2*(dy)-(dx);

x=x1; y=y1; putpixel(x,y,GREEN); while(x<=x2) { if(p<0) { x=x+1; p=p+2*(dy); } else { x=x+1; y=y+1; p=p+2*(dy-dx); } putpixel(x,y,GREEN); } getch(); closegraph(); }

OUTPUT

Question 5 : WAP to draw a circle using midpoint algorithm. Answer :


#include<stdio.h> #include<conio.h> #include<dos.h> #include<graphics.h> void circlemidpoint(int,int,int); void drawcircle(int,int,int,int); void main() { int xc,yc,r; int gd=DETECT,gm; initgraph(&gd,&gm,"c\\tc\\bgi"); printf("\nenter center coordinates of circle:"); scanf("%d%d",&xc,&yc); printf("enter radius of circle:"); scanf("%d",&r);

circlemidpoint(xc,yc,r); getch(); closegraph(); } void circlemidpoint(int xc,int yc,int r) { int x=0,y=r; int p=1-r; while(x<y) { drawcircle(xc,yc,x,y); x=x+1; if(p<0) p=p+2*x+1; else { y=y-1; p=p+2*(x-y)+1; } drawcircle(xc,yc,x,y); delay(50); } } void drawcircle(int xc,int yc,int x, int y) { putpixel(xc+x,yc+y,RED);

putpixel(xc-x,yc+y,RED); putpixel(xc+x,yc-y,RED); putpixel(xc-x,yc-y,RED); putpixel(xc+y,yc+x,RED); putpixel(xc-y,yc+x,RED); putpixel(xc+y,yc-x,RED); putpixel(xc-y,yc-x,RED); }

OUTPUT

Question 6 : WAP to draw an ellipse using midpoint algorithm. Answer :


#include<stdio.h> #include<dos.h> #include<graphics.h> void ellipsemidpoint(float,float,float,float); void drawellipse(float,float,float,float); void main() { float xc,yc,rx,ry; int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); printf("\nenter center of ellipse:"); scanf("%f%f",&xc,&yc); printf("\n enter x-radius coordinate"); scanf("%f",&rx); printf ("\n enter y-radius coordinate"); scanf("%f",&ry); ellipsemidpoint(xc,yc,rx,ry); getch(); } void ellipsemidpoint(float xc,float yc,float rx,float ry) { float rxsq=rx*rx; float rysq=ry*ry;

float x=0,y=ry,p; float px=0,py=2*rxsq*y; drawellipse(xc,yc,x,y); //Region 1 p=rysq-(rxsq*ry)+(0.25*rxsq); while(px<py) { x=x+1; px=px+2*rysq; if(p<0) p=p+rysq+px; else { y=y-1; py=py-2*rxsq; p=p+rysq+px-py; } drawellipse(xc,yc,x,y); delay(30); } //Region 2 p=rysq*(x+0.5)*(x+0.5)+rxsq*(y-1)-rxsq*rysq; while(y>0) { y=y-1; py=py-2*rxsq; if(p>0) p=p+rxsq-py; else

{ x++; px=px+2*rysq; p=p+rxsq-py+px; } drawellipse(xc,yc,x,y); delay(30); } } void drawellipse(float xc,float yc,float x,float y) { putpixel(xc+x,yc+y,RED); putpixel(xc-x,yc+y,RED); putpixel(xc+x,yc-y,RED); putpixel(xc-x,yc-y,RED); } OUTPUT

Question 7 : WAP to perform point clipping. Answer :


#include<stdio.h>

#include<conio.h> #include<graphics.h> #include<math.h> void initgraph() { int gd=DETECT,gm; initgraph(&gd,&gm,""); } void main() { int xmin,xmax,ymin,ymax; int x[20],y[20],n,i; clrscr(); printf("\n Enter xmin,xmax,ymin,ymax"); scanf("%d%d",&xmin); scanf("%d%d",&xmax); scanf("%d%d",&ymin); scanf("%d%d",&ymax); printf("\n Enter no. of point to be clipped"); scanf("%d%d",&n); for(i=0;i<n;i++) { printf("\n Enter the x point %d",i+1); scanf("%d",&x[i]); printf("\n Enter the y point %d",i+1); scanf("%d",&y[i]);

} initgraph(); // before clippint outtextxy(0,0,"after clipping"); rectangle(xmin,ymin,xmax,ymax); for(i=0;i<n;i++) { if((x[i]>=xmin && x[i]<=xmax || y[i]>=ymin && y[i]<=ymax)) { putpixel(x[i],y[i],4); } } getch(); closegraph(); } OUTPUT

Question 8 : WAP for line clipping cohen sutherland line clipping algorithm. Answer:
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h>

#define Round(val)((int)(val+.5)) int maxx,maxy,miny,minx;

void main() { int gd=DETECT,gm; void clipping(int xa,int ya,int xb,int y); int xa,xb,ya,yb; printf("Enter the window coordination"); scanf("%d%d%d%d",&minx,&maxy,&maxx,&miny); printf("Enter the two and points for the line"); scanf("%d%d%d%d",&xa,&ya,&xb,&yb); initgraph(&gd,&gm,""); rectangle(minx,miny,maxx,maxy); line(xa,ya,xb,yb); getch(); closegraph(); }

void clipping(int xa,int ya,int xb,int yb) { int Dx=xb-xa,Dy=yb-ya,steps,k; int visible1=0,visible2=0; float xin,yin,x=xa,y=ya; if(abs(Dx)>abs(Dy))

steps=abs(Dx); else steps=abs(Dy); xin=Dx/(float)steps; yin=Dy/(float)steps; putpixel(Round(x),Round(y),2);

for(k=0;k<steps;k++) { x+=xin; y+=yin; if((y>miny && y<maxx)) { visible1=1; putpixel(Round(x),Round(y),2); } else visible2=1; } if(visible1==0) outtextxy(20,200,"complextely visible"); if(visible1==1 && visible2==1) outtextxy(20,20,"partialy visible"); if(visible1==1&&visible2==0) outtextxy(20,20,"completly visible");

OUTPUT

Question 9 : WAP to perform translation in 2-D,3-D transformation. Answer : 2D


#include<stdio.h> #include<conio.h> #include<graphics.h> #include<process.h> #include<math.h> int x1,y1,x2,y2,x3,y3; void draw(); void tri(); void main()

{ int gd=DETECT,gm; int c; initgraph(&gd,&gm,""); printf("\n Enter the first point of traingle"); scanf("%d%d",&x1,&y1); printf("\n Enter the second point of traingle"); scanf("%d%d",&x2,&y2); printf("\n Enter the thrid point of traingle"); scanf("%d%d",&x3,&y3); cleardevice(); draw(); getch(); tri(); getch(); } void draw() { line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); } void tri() { int x,y,a1,a2,a3,b1,b2,b3; printf("\n Enter the translation cordinate");

scanf("%d%d",&x,&y); cleardevice(); a1=x1+x; b1=y1+y; a2=x2+x; b2=y2+y; a3=x3+x; b3=y3+y; line(a1,b1,a2,b2); line(a2,b2,a3,b3); line(a3,b3,a1,b1); } OUTPUT

3D
#include<graphics.h> #include<stdio.h> #include<conio.h> #include<math.h> #include<process.h>

int x1,x2,y1,y2,mx,my,depth; void draw(); void trans(); void main() { int gd=DETECT,gm,c; initgraph(&gd,&gm,""); printf("\n\t\t 3d transmission\n"); printf("\n Enter left top value(x1,y1)"); scanf("%d%d",&x1,&x2); printf("\n Enter right bottom value(x2,y2)"); scanf("%d%d",&x2,&y2); depth=(x2-x1)/4; mx=(x1+x2)/2; my=(y1+y2)/2; draw(); getch(); cleardevice(); trans(); getch(); } void draw() { bar3d(x1,y1,x2,y2,depth,1); } void trans()

{ int a1,a2,b1,b2,dep,x,y; printf("\n Enter the translation coodinate"); scanf("%d%d",&x,&y); a1=x1+x; a2=x2+x; b1=y1+y; b2=y2+y; dep=(a2-a1)/4; bar3d(a1,b1,a2,b2,dep,1); setcolor(5); draw(); } OUTPUT

Question 10: . WAP to show scaling in 2-D and in 3-D transformation. Answer :
#include<graphics.h> #include<stdio.h> #include<conio.h>

void scale(int figure[],int edges,int dx,int dy,int cx,int cy) { int i; for(i=0;i<edges;i++) { figure[2*i]=(figure[2*i]-cx)*dx+cx; figure[2*i+1]=(figure[2*i+1]-cy)*dy+cy; } } void main() { int i,figure[20],edges; int dx,dy,cx=0,cy=0; int gd=DETECT,gm; initgraph(&gd,&gm,""); clrscr();

printf("\n Enter the number of edges"); scanf("%d",&edges); for(i=0;i<edges;i++) { printf("\n Enter edge(x%d,y%d):",i,i); scanf("%d%d",&figure[2*i],&figure[2*i+1]); } figure[2*i]=figure[0]; figure[2*i+1]=figure[1]; edges+=1; printf("\n Enter dx"); scanf("%d",&dx); printf("\n Enter dy"); scanf("%d",&dy);

printf("\n Enter the centre of scaling"); printf("cx:"); scanf("%d",&cx); printf("cy:"); scanf("%d",&cy); cleardevice(); setbkcolor(WHITE); setcolor(GREEN); setlinestyle(SOLID_LINE,0,3); drawpoly(edges,figure); getch();

scale(figure,edges,dx,dy,cx,cy); setcolor(RED); drawpoly(edges,figure); getch(); }

OUTPUT

3D
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> void scale(); int maxx,maxy,midx,midy; void main() { int gd=DETECT,gm; detectgraph(&gd,&gm); initgraph(&gd,&gm,""); printf("\n scaling"); scale(); getch(); } void scale() { int x,y,z,o,x1,x2,y1,y2; maxx=getmaxx(); maxy=getmaxy(); midx=maxx/2; midy=maxy/2; bar3d(midx+50,midy-100,midx+60,midy-90,5,1); printf("\n before scaling"); printf("\n Enter scaling factor"); scanf("%d%d",&x,&y,&z);

printf("\n After scaling"); bar3d(midx+(x*50),midy-(y*100),midx+(x+60),midy-(y*90),5*z,1); }

OUTPUT

Question 11 : WAP to make a Indian flag. Answer :


#include<graphics.h> #include<conio.h> #include<stdio.h> void main() { int gd=DETECT,gm; clrscr(); initgraph(&gd,&gm,""); setcolor(5); line(20,50,20,180); line(20,50,100,50); line(20,70,100,70); line(20,90,100,90); line(20,110,100,110); line(100,50,100,110); circle(60,80,10); line(52,80,68,80); line(60,72,60,88); setfillstyle(SOLID_FILL,22); floodfill(21,51,5); setfillstyle(SOLID_FILL,7); floodfill(21,75,5); setfillstyle(SOLID_FILL,2); floodfill(21,95,5);

setfillstyle(SOLID_FILL,7); floodfill(81,75,5); setfillstyle(SOLID_FILL,7); floodfill(61,81,5); getch(); closegraph(); }

OUTPUT

Question 12 : WAP to make an attractive object like HUT/FISH/KITE. Answer : /*program to make a moving fish*/
#include<graphics.h>

#include<stdio.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { int gd=DETECT,gm; int x,y,r,c,mx,my; initgraph(&gd,&gm,"c:\\tc\\bgi"); printf("enter x,y,c"); scanf("%d%d%d",&x,&y,&c); mx=getmaxx(); my=getmaxy(); while(!kbhit()) { if((x>=mx)||(y>=my)) { while((x>0)||(y>0)) { cleardevice(); setcolor(c); ellipse(x,y,0,360,50,20); circle(x-40,y-5,2); line(x+50,y,x+80,y-30); line(x+80,y-30,x+80,y+30); line(x+80,y+30,x+50,y);

setfillstyle(1,0); floodfill(x,y,c); x=x-rand()%10; y=y-rand()%10; } } else { while((x<=mx)||(y<=my)) { cleardevice(); setcolor(c); ellipse(x,y,0,360,50,20); circle(x-40,y-5,2); line(x+50,y,x+80,y-30); line(x+80,y-30,x+80,y+30); line(x+80,y+30,x+50,y); setfillstyle(1,0); floodfill(x,y,c); x=x+rand()%10; y=y+rand()%10; } } delay(1000);

getch(); closegraph(); } OUTPUT

Question 13: WAP to make colorful squares and circles in Animation. Answer : Circles..
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<graphics.h> #include<dos.h> void main() {

int gd=DETECT,gm,n,m=0; initgraph(&gd,&gm,"");

/* if(ge!=grOk) { puts("Error!"); getch(); exit(0); }*/ while(!kbhit()) { //cleardevice(); setcolor(m++); for(n=0;n<=200;n++) { //setcolor(n%16); circle(getmaxx()/2,getmaxy()/2,200-n); delay(2);

} if(m==16) m=0; /*for(n=0;n<=200;n++) { setcolor(BLACK); circle(getmaxx()/2,getmaxy()/2,n);

delay(10); } } getch(); } OUTPUT

2.Colorful sqares
/*program to make colorful squares in animation*/ #include<stdio.h> #include<graphics.h> #include<conio.h> #include<dos.h> void main() { int d=2,k=0; int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); setcolor(2); outtextxy(300,430,"press any key to continue ...."); setcolor(5);

setwritemode(1); rectangle(180,120,380,320); getch(); clearviewport(); while(!kbhit()) { d%=91; setcolor(k); rectangle(180+d,120+d,380-d,320-d); delay(40); d+=2; k++; } getch(); }

OUTPUT

Question 14 : WAP to create a smiley. Answer:


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

main()

{ int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75; void *p;

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

setcolor(YELLOW); circle(50,100,25); setfillstyle(SOLID_FILL,YELLOW); floodfill(50,100,YELLOW);

setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(44,85,2,6); fillellipse(56,85,2,6);

ellipse(50,100,205,335,20,9); ellipse(50,100,205,335,20,10); ellipse(50,100,205,335,20,11);

area = imagesize(left, top, left + 50, top + 50); p = malloc(area);

setcolor(WHITE); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); outtextxy(155,451,"Smiling Face ");

setcolor(BLUE); rectangle(0,0,639,449);

while(!kbhit()) { temp1 = 1 + random ( 588 ); temp2 = 1 + random ( 380 );

getimage(left, top, left + 50, top + 50, p); putimage(left, top, p, XOR_PUT); putimage(temp1 , temp2, p, XOR_PUT); delay(100); left = temp1; top = temp2; }

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

OUTPUT

Question 15 : WAP to create a walking man on screen. Answer:


#include<graphics.h> int main() { int gd=DETECT, gm; int i; int walk=0;

initgraph(&gd, &gm ,"c:\\tc\\bgi");

setcolor(BROWN); bar3d(10,280,getmaxx()-50,320,10,50); outtextxy(200,300,".......M G ROAD........");

setcolor(WHITE); circle(70,140,30); circle(60,130,3); circle(80,130,3); line(70,135,70,145); //line(65,155,75,155); arc(70,140,60,120,15);

line(70,170,70,220); line(70,170,50,220); line(70,170,90,220); line(70,220,55,270); line(70,220,85,270);

setcolor(9); fillellipse(150,100,60,40); outtextxy(110,90,"hi" ); outtextxy(110,100,"go for a walk?");

delay(5000);

for(i=0;i<30;i++)

{ cleardevice(); walk+=5; bar3d(10,280,getmaxx()-50,320,10,50); circle(70+walk,140,30); line(70+walk,170,70+walk,220); line(70+walk,170,40+walk,220); line(70+walk,170,100+walk,220); line(70+walk,220,30+walk,270); line(70+walk,220,110+walk,270); delay(500);*/ walk+=5; cleardevice(); setcolor(BROWN); bar3d(10,280,getmaxx()-50,320,10,50); outtextxy(200,300,".......M G ROAD......."); setcolor(WHITE); circle(70+walk,140,30); line(70+walk,170,70+walk,220); line(70+walk,170,50+walk,220); line(70+walk,170,90+walk,220); line(70+walk,220,55+walk,270); line(70+walk,220,85+walk,270); delay(250); walk+=5; cleardevice();

circle(70+walk,140,30); line(70+walk,170,70+walk,270); setcolor(BROWN); bar3d(10,280,getmaxx()-50,320,10,50); outtextxy(200,300,"........M G ROAD......."); delay(250); walk+=5; cleardevice(); bar3d(10,280,getmaxx()-50,320,10,50); outtextxy(200,300,".........M G ROAD......."); setcolor(WHITE); circle(70+walk,140,30); line(70+walk,170,70+walk,220); line(70+walk,170,60+walk,220); line(70+walk,170,80+walk,220); line(70+walk,220,55+walk,270); line(70+walk,220,85+walk,270);

delay(250); } circle(60+walk,130,3); circle(80+walk,130,3); line(70+walk,135,70+walk,145); line(65+walk,155,75+walk,155); //arc(70,140,60,120,15);

setcolor(8); fillellipse(walk-10,100,60,40); outtextxy(walk-30,100,"okk bye"); delay(2500); getch(); closegraph(); return 0; }

OUTPUT

You might also like