#include <stdio.h>
#include <math.h>
#include <time.h>
#include <windows.h>
void gotoxy(int x,int y)
{
COORD pos={x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void setColor(int x) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
}
int main()
{
int k,i, x=0, y=0,u=0,d=-1,m;
int a[20] = {0};
char words[100][20] = {"banana", "mandarine", "watermelon", "gyul", "earth", "land", "world", "sc"};
char b;
srand(time(NULL));
k = rand()%8;
gotoxy(3,5);
printf ("_");
gotoxy(0,3);
setColor(7);
printf("몫슴 =");
gotoxy(0,5);
setColor(2);
printf("-> ");
m=10;
while(1)
{
y=0;
gotoxy(0,0);
for (i=0; i<strlen(words[k]); i++)
{
if (a[i]==1)
{
printf ("%c ",words[k][i]);
y++;
}
else
{
setColor(4);
printf ("_ ");
}
}
if (u==y)
{
m--;
}
gotoxy(9,3);
setColor(7);
printf(" %d", m);
u=y;
if (m==0)
{
gotoxy(0,7);
printf ("이런 !");
break;
}
printf("\n");
x=0;
for (i=0; i<strlen(words[k]); i++)
{
if(a[i]==1)
{
x++;
}
}
if (x==strlen(words[k]))
{
gotoxy(0,7);
printf ("축하해!");
}
gotoxy(3,5);
scanf (" %c",&b);
for (i=0; i<strlen(words[k]); i++)
{
if (b==words[k][i])
{
a[i]=1;
}
}
gotoxy(3,5);
printf ("_");
}
return 0;
}
다음주 까지 제발~~~~~~~~