Pages

Thursday 27 June 2013

Walking Man C program


Walking Man C program



#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm,c=200,i=0,x=40,l=15,h=15,ht=0;
initgraph(&gd,&gm,"c:\tc\bgi");
cleardevice();
setcolor(5);
cont:
while(!kbhit())
{
setcolor(14);
circle(x-20,115,15);
line(x-20,130,x-20,175);
line(x-20,175,x-20-l,200);
line(x-20,175,x-20+l,200);
line(x-20,140,x-20+h,160);
line(x-20,140,x-20-h,160);
for(i=0;i<620;i+=20)
{
 }
c++;
if(c==0)
c=100;
setcolor(0);
delay(50);
ellipse(x,100,0,180,50,30);
line(x-50,100,x+50,100);
line(x,100,x,150);
circle(x-20,115,15);
line(x-20,175,x-20-l,200);
line(x-20,175,x-20+l,200);
line(x-20,140,x-20-h,160);
line(x-20,140,x-20+h,160);
x++;
l--;
if(l==-15)
l=15;
if(ht==1)
h++;
else
h--;
if(h==15)
 ht=0;
else if(h==-15)
 ht=1;
if(getch()==' ')
 {
 while(!kbhit())
 getch();
 goto cont;
 }
}
}

0 comments:

Post a Comment