jesuis un debutant en c++ et je doit fair un projet de motus et j ai fait ce travail mais il y a un probleme que j ai pas arrivé a le comprendre voila mon travail :
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
#include<string.h>
void enplace(char mot[22][8],int nb,char ch[8],char ch2[8])
{int i,j;
j=0;
for (i=0;i<=7;i++)
{if(ch[i]== mot[nb][j])
ch2[j]= ch[i];
else
ch2[j]='*';
j++;}
printf(" les lettres qui sont en places sont ");
puts (ch2);
}
void nenplace (char mot[22][8],int nb,char ch[8],char ch2[8])
{int i,j;char ch4[8];char ch3[8];
for (i=0;i<=7;i++)
{for (j=0;j<=7;j++)
if(ch[i]== mot[nb][j] && ch[i]!=ch2[j] && ch[i]!=ch3[j])
//le probleme est ici {ch3[j]=mot[nb][j];
ch4[i]=ch[i];}
else
ch4[i]='*';}
//printf("Les lettres qui ne sont pas à leurs places sont ");
puts(ch4);
}
main()
{char mot[22][8];char ch[8];int sr=0;char ch2[8];
srand(time(0));
void enplace(char mot[22][8],int nb,char ch[8],char ch2[8]);
void nenplace(char mot[22][8],int nb,char ch[8],char ch2[8]);
int i=0,nb;
strcpy (mot[0],"intence");
strcpy (mot[1],"taxable");
strcpy (mot[2],"accueil");
strcpy (mot[3],"acheter");
strcpy (mot[4],"acompte");
strcpy (mot[5],"activer");
strcpy (mot[6],"agjuger");
strcpy (mot[7],"adresse");
strcpy (mot[8],"affaire");
strcpy (mot[9],"aimable");
strcpy (mot[10],"ajuster");
strcpy (mot[11],"alliage");
strcpy (mot[12],"amazone");
strcpy (mot[13],"analyse");
strcpy (mot[14],"animale");
strcpy (mot[15],"armures");
strcpy (mot[16],"barrage");
strcpy (mot[17],"binaire");
strcpy (mot[18],"boitier");
strcpy (mot[19],"bonheur");
strcpy (mot[20],"boucler");
strcpy (mot[21],"bowling");
strcpy (mot[22],"calibre");
nb= int(rand()%21)+1;
puts(mot[nb]);
printf("\t bien venu dans votre jeu motus \n");
printf("entrer un mot qui commence par: \n");
printf("%c \n",mot[nb][0]);
do{
gets(ch);
if(strcmp(mot[nb],ch)==0)
{printf("vous avez trouve le bon mot felicitation");
sr =1;}
else
{enplace(mot,nb,ch,ch2);
nenplace(mot,nb,ch,ch2);}
i++;
}while(sr==0 && i>7);
getch();}
et merci d'avance


