#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
void right(int,int);
void main()
{
int gd=DETECT,gm,i,t,j;
initgraph(&gd,&gm,"");
setcolor(4);
//vertical
line(225,200,225,400);
line(250,200,250,400);
line(275,200,275,400);
line(300,200,300,400);
line(325,200,325,400);
line(350,200,350,400);
line(375,200,375,400);
//horizontal
line(200,225,400,225);
line(200,250,400,250);
line(200,275,400,275);
line(200,300,400,300);
line(200,325,400,325);
line(200,350,400,350);
line(200,375,400,375);
setlinestyle(0,5,3);
rectangle(200,200,400,400);
//circle
setlinestyle(0,5,1);
setcolor(YELLOW);
circle(212,212,1);
circle(212,212,2);
printf("Enter your option for move:\n");
printf("1:Right\n2:Forward\n3:Side\tOption:");
scanf("%d",&t);
switch(t)
{
case 1:
{
int m=0;
j=1;
right(m,j);
}
case 2:
{
int m=1;
j=0;
right(m,j);
}
}
getch();
}
void right(int l,int i)
{
if(l==1)
{
i=l;
}
getch();
for(i=1;i<=25;i++)
{
setcolor(4);
//vertical
line(225,200,225,400);
line(250,200,250,400);
line(275,200,275,400);
line(300,200,300,400);
line(325,200,325,400);
line(350,200,350,400);
line(375,200,375,400);
//horizontal
line(200,225,400,225);
line(200,250,400,250);
line(200,275,400,275);
line(200,300,400,300);
line(200,325,400,325);
line(200,350,400,350);
line(200,375,400,375);
setlinestyle(0,5,3);
rectangle(200,200,400,400);
//circle
setlinestyle(0,5,1);
setcolor(YELLOW);
circle(212+l,212+i,1);
circle(212+l,212+i,2);
delay(50);
cleardevice();
}
}
No comments:
Post a Comment