NOTE:- here for move name i use key 'a' ,'s' ,'w' ,'z' . you can use another key also by changing in switch case simply;
#include<stdio.h>
void main()
{
int x,y;
char ch;
clrscr();
printf("Enter value of x and y");
scanf("%d%d",&x,&y);
gotoxy(x,y);
printf("rajnish tripathi");
while(1)
{
ch=getch();
switch(ch)
{
case 'a': x--;
break;
case 's': x++;
break;
case 'w': y--;
break;
case 'z': y++;
break;
case 27 : exit(0);
}
clrscr();
gotoxy(x,y);
printf("rajnish tripathi");
}
}
0 Comments