fix
This commit is contained in:
		
							
								
								
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@@ -1,6 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
    "files.associations": {
 | 
			
		||||
        "algorithm": "c",
 | 
			
		||||
        "format": "c"
 | 
			
		||||
        "format": "c",
 | 
			
		||||
        "cstdlib": "c"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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
 | 
			
		||||
							
								
								
									
										15
									
								
								pendu.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								pendu.c
									
									
									
									
									
								
							@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user