كود hang man
كود:
#include<conio.h>
#include<stdio.h>
void main()
{
char str[80];
gets(str);
clrscr();
char g,word[20];
int k ;
int l=strlen(str);
for( k=0;k<l;k++)
word[k]='*' ;
word[k]='\0';
printf("%s \n ",word) ;
for(int i=0;i<(2*l);i++)
{
printf("\n\n enter your character ");
scanf("%s",&g);
for(int j=0;j<l;j++)
{
if(str[j]==g)
word[j]=g;
}
printf("\n %s",word) ;
if(strcmp(word,str)==0)
break ;
}
if(strcmp(word,str))
{
printf("\n sorry you are lose");
printf("\n the word %s",str);
}
else
printf("\n\n OH !!!!!!!!! you are win");
getch();
}