This program is supposed to put a "%" on the screen then move it around when the user presses keys.
a: left
s: right
w: up
z: down
It doesn't work. The program just puts another "%" right next to the other one.
#include <iostream.h>
#include <conio.h>
char key;
int x = 35, y = 18;
int main(){
key = getch();
for(;;){
gotoxy(x,y);
cout << "%";
getch();
switch(key){
case 'a':
x--;
break;
case 's':
x++;
break;
case 'w':
y--;
break;
case 'z':
y++;
break;
}
}
}