Bonjour a tous je suis actuellement étudiant en informatique (pure débutant) et je cherche a résoudre mes problèmes suite a ce code que j'ai confectionné si jamais vous pouvez m'apporter de l'aide s'il vous plait je serais très reconnaissant.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
 
char lireCaractere();
 
 
char *strdup(const char *s) {
    char *d;
    d = malloc((strlen(s)+1) * sizeof(char));
    strcpy(d, s);
    return d;
}
 
int main(int argc, char *argv[])
{
    FILE *f;
    char **dictionnaire;
    char mot[81];
    size_t nmots;
 
 
    f = fopen("P:\\MiniMousseau\\Mots.txt", "r");
    fscanf(f, "%d", &nmots);
    dictionnaire = malloc(nmots * sizeof(char *));
 
    for (size_t i = 0; i < nmots; ++i) {
        fscanf(f, "%80s", mot);
        dictionnaire[i] = strdup(mot);
    }
 
    for (size_t i = 0; i < nmots; ++i)
        printf("Mot no %d: '%s'\n", i, dictionnaire[i]);
 
 
 
    long nombrecoups = 6
    char motsecret;
    long nombrecaracteres = 0;
    long i = 0;
    char caractereentre;
    char *motdecouvert;
    printf("Bienvenue dans le jeu du pendu\n\n");
    nombreCaracteres = strlen(motMystere);
    motDecouvert = (char *) malloc(nombreCaracteres * sizeof(char));
    for(i=0;i<nombreCaracteres;i++) motDecouvert[i]='*';
    do
    {
        i = 0;
        printf("%ld Coups restants\n", nombreCoups);
 
        printf("Quelle est le mot cache : ");
 
        do
        {
            printf("%c", motDecouvert[i]);
            i++;
        } while(i != nombreCaracteres);
        printf("\n");
        printf("Saisissez une lettre : ");
        caractereEntre = lireCaractere();
        trouverEtRemplacer(motMystere, motDecouvert, caractereEntre, nombreCaracteres);
        if(strchr(motMystere, caractereEntre) == 0)
        {
 
            nombreCoups--;
        }
 
    } while(nombreCoups != 0);
    */
    return 0;
}
char lireCaractere()
{
    char caractere = 0;
 
    caractere = getchar();
    caractere = toupper(caractere);
 
 
    while (getchar() != '\n') ;
 
    return caractere;
 
}
 
void trouverEtRemplacer(char motSecret[], char motTrouver[], char lettre)
{
    char caractereActuel = 0;
    long i = 0;
 
    do
    {
        caractereActuel = motSecret[i];
 
        if(caractereActuel == lettre)
        {
            motTrouver[i] = motSecret[i];
        }
        i++;
    }while(motSecret[i] != '\0');
}