1
0

yanis #3

Closed
Yanis DARIUS wants to merge 3 commits from yanis into master
4 changed files with 18 additions and 3 deletions
Showing only changes of commit 6a39663c84 - Show all commits

View File

@ -1,6 +1,7 @@
{
"files.associations": {
"algorithm": "c",
"format": "c"
"format": "c",
"cstdlib": "c"
}
}

View File

@ -0,0 +1,3 @@
ex2 les functionnalité ont etait codé la mienne ne functionne pas pour l instant on passe
la creation de pull request

BIN
pendu Executable file

Binary file not shown.

15
pendu.c
View File

@ -24,6 +24,11 @@ const char *words[MAX_WORDS] = {
"eclesiastique"
};
// Prototypes des fonctions
char** selecte_words(int word_length, int* size);
char** word_merge(int word_length, int* size2);
char** merge_string_arrays(char** array1, char** array2, int size1, int size2);
void display_hangman(int tries) {
switch (tries) {
case 0: printf(" ----\n | |\n |\n |\n |\n |\n--------\n"); break;
@ -76,10 +81,16 @@ char* difficult(int word_length) {
printf("Erreur lors de la fusion finale des mots\n");
return NULL;
}
// Sélectionner un mot aléatoire
char* chosen_word = final_words[rand() % (size1 + size2)];
// Libérer la mémoire du tableau final_words après avoir choisi un mot
for (int i = 0; i < size1 + size2; i++) {
free(final_words[i]);
}
free(final_words);
return chosen_word;
}
@ -168,7 +179,7 @@ int main() {
int word_length = ask_word_length();
const char* word = difficult(word_length);
printf("le mot est :%s",word);
if (word == NULL) {
printf("Erreur : aucun mot disponible avec cette longueur.\n");
return 1;