0 이동이 잘안되요
비
2023.04.01
오류나는이유가뭘까요0이 안지워짐니다..ㅜㅜ질문 내용 :아래에서 0이 안지워져요 이동하고 난곳에 0이 지워지게하려고했는데.
#include stdio.h
#include stdlib.h
#include windows.h
#include conio.h
#define left 75
#define right 77
#define up 72
#define down 80
char push;
int x=10;
int y=10;
//gotoxy gotoxy함수 사용시
void gotoxy(int x, int y)
{
coord pos = {x, y};
setconsolecursorposition(getstdhandle(std_output_handle), pos);
}
//gotoxy gotoxy함수 사용시
//이동
void agent(){
push = getch();
printf( );
switch (push) {
case up: printf(0); y--; break;
case down: printf(0); y++; break;
case left: printf(0); x--; break;
case right: printf(0); x++; break;
}
gotoxy(x,y);
}
int main()
{
while(1){
agent();
}
}