#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <conio.h>#define WORDSIZE 10
/*修正よろ*/
void main(void)
{
   char *word[]={"cat", "dog", "dictionary"};
   int f, len, num, count=0, wordcheck[WORDSIZE];
   char buff;

   srand(time(NULL));
   num=rand()%3+1;
   len=strlen(word[num]);
   for(f=0; f<len; f++){
      putchar('*');
      wordcheck[f]=0;
   }

   do{
      buff=getch();
      putchar('\n');
      for(f=0; f<len; f++){
         if(buff==word[num][f] && !wordcheck[f]){
            count++;
            wordcheck[f]++;
            putchar(word[num][f]);
         }
         else if(wordcheck[f]) putchar(word[num][f]);
         else putchar('*');
      }
   }while(count!=len);
   printf("終了\n");
}