#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<Windows.h>
#define ESC 0x1b
#define MAX_X 75
#define MAX_Y 24
void gotoxy(int x, int y)
{
COORD Pos = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
void main()
{
char ch = 'A';
char input = 0;
int x,y;
int score = 0;
srand(time(NULL));
while(input!=ESC)
{
ch = (rand()% 26) +'a';
x=rand()%MAX_X;
y=rand()%MAX_Y;
gotoxy(x,y);
printf("%c",ch);
input = _getch();
if(input == ch)
score++;
gotoxy(0,24);
printf("점수 : %d",score);
}
}
여기까지 했고
esc를 누르면 종료하고 종료후 enter키를 누르면 재식작이 하도록 구현 해야하는데
-재시작시 화면 clear한 후 시작
-initialize()함수로 구현
-tip 화면의 모든 좌표에 ' ' (빈칸)을 출력하면 됨
좀 도와 주삼 ㅠㅠ
댓글 0