- #include "dico.h"
-
- void main()
- {
- int vie_=3;
-
- START: do
- {
- char mot[32],mot_d[32];
- char *mot_devine=(char*)malloc(sizeof(char));
- char *mon_mot=(char*)malloc(sizeof(char));
- char lettre;
- int h,i,vie=9,test=1;
- time_t s;
-
- clrscr();
-
- srand( (unsigned) time (&s) );
- h=rand()%40;
- mot_devine=DICTIONNAIRE[h];
-
- strcpy(mot_d,mot_devine);
-
- for(i=0;i<int(strlen(mot_devine));i++)
- mot[i]='-';
-
- do {
- clrscr();
-
-
- mot[i]='\0';
-
- if(test==0)
- vie--;
-
- for(i=0;i<int(strlen(mot_devine));i++)
- printf("%c",mot[i]);
-
- gotoxy(65,1);printf("VIE(S): %d",vie_);
- gotoxy(65,2);printf("LETTRE(S): %d",vie);
-
-
- if( (strcmp(mon_mot,mot_devine))==0 )
- {
- clrscr();
- gotoxy(35,10);printf("GAGNE");
- vie=0;
- getch();
- goto START;
- }
-
- printf("\n\nVotre lettre: ");
- scanf(" %c",&lettre);
-
- if(lettre>90)
- lettre=lettre-32;
-
- test=0;
-
- for(i=0;i<int(strlen(mot_devine));i++)
- if(lettre==mot_d[i])
- {mot[i]=lettre;test=1;}
- else
- if(mot[i]=='-')
- mot[i]='-';
-
- strcpy(mot_devine,mot_d);
- strcpy(mon_mot,mot);
-
-
- } while(vie>0);
-
- clrscr();
- gotoxy(32-strlen(mot_devine),10);printf("PERDU\t:\t%s",mot_devine);
- vie_--;
- getch();
- }
- while(vie_>0);
- }
#include "dico.h"
void main()
{
int vie_=3;
START: do
{
char mot[32],mot_d[32];
char *mot_devine=(char*)malloc(sizeof(char));
char *mon_mot=(char*)malloc(sizeof(char));
char lettre;
int h,i,vie=9,test=1;
time_t s;
clrscr();
srand( (unsigned) time (&s) );
h=rand()%40;
mot_devine=DICTIONNAIRE[h];
strcpy(mot_d,mot_devine);
for(i=0;i<int(strlen(mot_devine));i++)
mot[i]='-';
do {
clrscr();
mot[i]='\0';
if(test==0)
vie--;
for(i=0;i<int(strlen(mot_devine));i++)
printf("%c",mot[i]);
gotoxy(65,1);printf("VIE(S): %d",vie_);
gotoxy(65,2);printf("LETTRE(S): %d",vie);
if( (strcmp(mon_mot,mot_devine))==0 )
{
clrscr();
gotoxy(35,10);printf("GAGNE");
vie=0;
getch();
goto START;
}
printf("\n\nVotre lettre: ");
scanf(" %c",&lettre);
if(lettre>90)
lettre=lettre-32;
test=0;
for(i=0;i<int(strlen(mot_devine));i++)
if(lettre==mot_d[i])
{mot[i]=lettre;test=1;}
else
if(mot[i]=='-')
mot[i]='-';
strcpy(mot_devine,mot_d);
strcpy(mon_mot,mot);
} while(vie>0);
clrscr();
gotoxy(32-strlen(mot_devine),10);printf("PERDU\t:\t%s",mot_devine);
vie_--;
getch();
}
while(vie_>0);
}