#include "stdio.h"

#include "conio.h"

#include "Windows.h"

#include "math.h"


#define randomize() srand((unsigned)time(NULL))

#define rand(n) (rand() % (n))


void gotoxy(int x, int y)

{


COORD Pos;

Pos.X = x;

Pos.Y = y;

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);

}

char *GetStrchrN(char* dest,char* src, char key)

{

for (;*src != NULL; *src++, *dest++) {

if (*src == key) 

*dest = key;

}

}

void main()

{

char arList[6]+ = { "stdio.h","conio.h","windows.h","math.h","sting.h" };

char arCopy+;

char arPrint+;

char key;

char *pFind;

int i;

gotoxy(20, 10);

printf("Hang Man  종료=ESC");



for (;;) {

strcpy(arCopy, arList[rand(5)]);

strcpy(arPrint, arCopy);

_strset(arPrint, '_');

for (;;) {

gotoxy(40, 12);

printf("%s", arPrint);

key = _getch();

tolower(key);

system("cls");

if (strcmp(arPrint, arCopy) == 0) break;

GetStrchrN(arPrint, arCopy, key);

}

}

}

욕해도 된다