왜 공이출력이안돼는걸까요..?
하림
질문 제목 : 왜 공이출력이안돼는걸까요,..?질문 내용 : #include stdio.h
#include windows.h
#define left 75
#define right 77
gotoxy(int x, int y)
{
coord pos = {x, y};
setconsolecursorposition(getstdhandle(std_output_handle), pos);
}
void textcolor(int color_number)
{
setconsoletextattribute(getstdhandle(std_output_handle),color_number);
}
ball();
character();
int c_x=32;
int c_y=23;
main(){
system(mode con cols=70 lines=25);
while(1){
character();
ball();
}
sleep(50);
}
character(){
int key;
gotoxy(c_x,c_y);
printf(ㅡㅡㅡㅡ);
if(kbhit()){
key=getch();
gotoxy(c_x,c_y);
printf( );
switch(key){
case left:
if(c_x0)
c_x--;
break;
case right:
if(c_x62)
c_x++;
break;
}
gotoxy(c_x,c_y);
printf(ㅡㅡㅡㅡ);
}
gotoxy(0,0);
printf(%d,c_x);
}
ball(){
int b_x=35;
int b_y=15;
if(b_x==c_x && b_y==c_y){
gotoxy(b_x,b_y);
printf(ⓢ);
gotoxy(b_x,b_y);
printf( );
b_x++;
b_y++;
gotoxy(b_x,b_y);
printf(ⓢ);
}
}