#include <stdio.h>
#include <Windows.h>
#include <conio.h>

#define UP 'w'
#define DOWN 's'
#define LEFT 'a'
#define RIGHT 'd'


void gotoxy(int x, int y);
void move(char arrow, int *x, int *y);

int main()
{

 int x = 20, y = 20;
 char ch;

 do {
  
  gotoxy(x, y);
  ch = _getch();
  move(ch, &x, &y);
  printf("a");
 }

 while ((ch != EOF));
  

}

void gotoxy(int x, int y)
{
 
 COORD pos = { x,y};

 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);

}

void move(char arrow, int *x, int *y)
{
 switch(arrow)
 {
 case UP: //error
 {
  *y -= 1;
 }

 case DOWN:
 {
  *y += 1;
 }

 case LEFT: // error
 {
  *x -= 1;
 }

 case RIGHT:
 {
  *x += 1;
 }

}


}



wasd로 움직이면서 a 찍는 코드 짜고 싶은데


wa는 아예 안움직이고 sd만 움직인다 ㅠㅠ