#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void base()
{
int k,l;
for(k=0;k<20;l=l+16,k++)
{
rectangle(100+l,400,116+l,418); //square box
line(107+l,418,107+l,413); //middle down to up line
line(107+l,413,100+l,409); //middle to left side
line(107+l,413,112+l,400); //middle to up side
rectangle(100+l,418,116+l,436);
line(107+l,436,107+l,431);
line(107+l,431,100+l,427);
line(107+l,431,112+l,418);
}
}
int main()
{
int gd=DETECT,gm;
int i,j,k,l,ch1,ch2,x=90,y=389;
initgraph(&gd,&gm,"c:\\tc\\bgi");
//base();
ch1=getch();
while(ch1==32)
{
base();
if(ch1!=32)
return 0;
ch2=getch();
if(ch2!=97&&ch2!=119&&ch2!=100)
return 0;
switch(ch2)
{
case 97:
cleardevice();
x=x+5;
if(x==100)//if(x==150&&y==100)
circle(x,y+18,10);//y=y+18;
break;
case 119:
cleardevice();
for(j=1;j<11;j++)
{
base();
delay(100);
cleardevice();
if(j==1||j==2||j==3||j==5||j==6||j==7||j==9||j==10)
{
//base();
//cleardevice();
x=x+1;
}
y=y-1;
circle(x,y,10);
//base();
}
for(i=1;i<11;i++)
{
base();
delay(100);
cleardevice();
if(j==1||j==2||j==3||j==5||j==6||j==7||j==9||j==10)
{
//cleardevice();
x=x+1;
}
y=y+1;
circle(x,y,10);
}
break;
case 100:
cleardevice();
x=x-5;
break;
}
circle(x,y,10);
}
ch1=getch();
getch();
closegraph();
return 0;
}
naveen1993
-3
Newbie Poster
Recommended Answers
Jump to PostSo what specifically are you trying to do and what is it not doing that you are expecting or what is it doing that you are not expecting?
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.