gotoxy if
초코초코해
질문 제목 :gotoxy if질문 내용 : #include stdio.h
#include conio.h
#include windows.hint ch;
int cursor = -1;
int pos_bottom[10] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 38};void gotoxy(int x, int y)
{
coord pos = {x, y};
setconsolecursorposition(getstdhandle(std_output_handle), pos);
}void move()
{
///// 버그
if (cursor != -1) {
gotoxy(pos_bottom[cursor], 5);
printf( );
}
if (cursor != 0 && ch == 75) {
gotoxy(pos_bottom[--cursor], 5);
printf(√);
}
if (cursor != 9 && ch == 77) {
gotoxy(pos_bottom[++cursor], 5);
printf(√);
}
}int main()
{
printf(┏━━━━━━━━━━━━━━━━━━━┓\n);
printf(┃top ┃\n);
printf(┣━━━━━━━━━━━━━━━━━━━┫\n);
printf(┃ ┃\n);
printf(┣━┳━┳━┳━┳━┳━┳━┳━┳━┳━┫\n);
printf(┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃\n);
printf(┣━┻━┻━┻━┻━┻━┻━┻━┻━┻━┫\n);
printf(┃bottom & ┃\n);
printf(┗━━━━━━━━━━━━━━━━━━━┛); while (1) {
ch = getch();
if (ch == 75 || ch == 77)
move();
} return 0;
}
프로그램을 실행시키고방향키로 체크표시를 나타나게 한다음오른쪽 끝이나 왼쪽 끝을 계속가면 체크표시가 사라져버리는데저 소스를 어떻게 고쳐야 해결이 될까요..?(함수를 더 만들면 안됨)