Bonjour a tous, je m'appelle Maverick et dans le cadre d'un projet en langage C ( je suis en 1ere année de bachelier en Belgique ) je dois creer un porgramme qui s'occupe de la gestion d'un cinema .

Pour l'instant il est encore incomplet mais j'ai voulu tester si ce que j'avais fais marchais deja.

Voici mon code

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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#include <stdio.h>
#include <conio-bis.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <windows.h>
 
void consulter ();
void tarifs ();
void synopsis ();
void sorties ();
void modifier ();
 
struct film saisie ();
struct film 
{
    char titre[50],acteur[50],genre[50],horraire[50];
    int duree[50];
    float tarifs[50];
    short supp;
};
int main ()
{
    int choix,n;
 
    do
    {
        printf("Faites votre choix,  1: consulter \n 2: tarifs \n 3: synopsis \n 4: sorties \n 5: modifier \n 6: quitter ");
        scanf("%d",&choix);
    }
    while (choix<1 || choix>4)  ;
    switch (choix)
    {
        case 1 : consulter();break;
        case 2 : tarifs();break;
        case 3 : synopsis();break; 
        case 4 : sorties();break;
        case 5 : modifier ();break;
        case 6 : exit(0); break; 
    }
 
    getch ();
    return 0;
}
 
 
void consulter ()
{
    struct film a;
    FILE *f;
    int n,nb;
    f=fopen("d:/cinema.dat","rb");
    if(f)
    { 
        fseek(f,0L,SEEK_END);//se d?placer ? la fin du fichier
        n=ftell(f);//position courante dans le fichier
        nb=n/sizeof(a);//cacul du nombre de records
        printf("\nil y a %d films enregistres dans le fichier",nb);
        rewind(f);//revenir au d?but du fichier
        fread(&a,sizeof(a),1,f);
        while(!feof(f))
        { 
            if(a.supp==0)
            {
                printf("\n titre: %s \nacteur principal : %s  \ngenre : %s  \nhorraire : \nduree : %d  ",a.titre,a.acteur,a.genre,a.horraire,a.duree);
            } 
            fread(&a,sizeof(a),1,f);
 
        }
        fclose(f);
    }
    else
        printf("\nle fichier n'existe pas");
}
void tarifs ()
{
    int age;
    int place,prix=0;
 
    printf("entre votre age ");
    scanf("%d",&age);
    if (age<18)
    {
        printf("Vous etes considere comme enfant , le prix d'un ticket enfant est de 5 euros ");
        printf("combien de places enfants voulez vous ?");
        scanf ("%d",&place);
        prix=prix+(place*5);
        printf("Vous devez payer : %d ", prix);	
    }
    if(age>18)
    {
        printf("Vous etes considere comme adulte , le prix d'un ticket enfant est de 8 euros ");
        printf("combien de places adultes voulez vous ?");
        scanf ("%d",&place);
        prix=prix+(place*8);
        printf("Vous devez payer : %d ", prix);	
    }
}
void synopsis ()
{
 
}
void sorties ()
{
 
}
void modifier ()
{
    void ajouter ();
    void supprimer ();
    char changer (char);
    char mdp, n;
    int choix;
 
    printf ("entrez votre mot de passe pour confirmer que vous etes l'admin ");
    scanf ( "%s ",&mdp);
    printf("verification en cours .") ; system("PAUSE"); printf("."); system("PAUSE"); printf(".");
    do
    {
        printf("Faites votre choix,  1: ajouter \n 2: modifier \n 3: supprimer \n 4: quitter ");
        scanf("%d",&choix);
    }
    while (choix<1 || choix>4)  ;
    switch (choix)
    {
        case 1 : ajouter();break;
        case 2 :  printf("\nNom du film? ");scanf("%s",n);changer(n);break;
        case 3 : supprimer();break;      
        case 4 : exit(0); break; 
    }
}
 
void ajouter ()
{
    struct film a;
    FILE *f;
    f=fopen("d:/cinema.dat","ab");
    if(f)
    { 
        a=saisie();
        fwrite(&a,sizeof(a),1,f);
        fclose(f);
    }
    else
        printf("\nerreur ");
}
 
struct film saisie()
{ 
    struct film tmp;
    printf("\n titre du film? ");
    scanf("%s",tmp.titre);
    fflush(stdin);
    printf("\nacteur principal ? ");
    scanf("%s",tmp.acteur);
    fflush(stdin);
    printf("\ngenre ? ");
    scanf("%s",tmp.genre);
    fflush(stdin);
    printf("\nhorraire ? ");
    scanf("%s",tmp.horraire);
    fflush(stdin);
    printf("\nduree (en min) ? ");
    scanf("%d",tmp.duree );
    fflush(stdin);
    printf("\ntarifs (en euros) ? ");
    scanf("%f",tmp.tarifs );
    fflush(stdin);
    tmp.supp=0;
    return  tmp;
} 
 
void changer ( char *n)
{
    FILE *f;
    char rep;
    int flag=0;
    struct film tmp;
 
    f=fopen("d:/cinema.dat","r+b");
    if(f)
    {
        fread(&tmp,sizeof(tmp),1,f);
        while(!feof(f)&&flag==0)
        {
            if(tmp.supp==0)
            {
                if (strcmp(n,tmp.titre)==0)
                { 
                    printf("\ntitre : %s, acteur principal : %s ",tmp.titre,tmp.acteur);
                    printf("\nest-ce le bon film(o/n) ? ");
                    scanf(" %c",&rep);
                    fflush(stdin);
                    if(rep=='o'||rep=='O')
                    { 
                        tmp=saisie();
                        fseek(f,-1*sizeof(tmp),SEEK_CUR);
                        fwrite(&tmp,sizeof(tmp),1,f);
                        flag=1;
                    }
                    else
                    {
                        printf("\nfilm suivant du meme nom ");
                        fread(&tmp,sizeof(tmp),1,f); 
                    }
                }
                else
                fread(&tmp,sizeof(tmp),1,f);    
            }
            else
            fread(&tmp,sizeof(tmp),1,f);   
        }
        fclose(f);
        if(flag==0)
            printf("\nle film n'est pas dans le fichier ");
    }
    else
    printf("\nerreur");
}
 
void supprimer ( char *n)
{
    FILE * f;
    struct film a;
 
    char rep;
    int flag=0;
    f=fopen("d:/cinema.dat","r+b");
    if(f)
    {
        fread(&a,sizeof(a),1,f);
        while(!feof(f)&&flag==0)
        {
            if(a.supp==0) 
            {
                if(strcmp(a.titre,n)==0)     
                {
                    printf("\n titre : %s acteur : %s",a.titre,a.acteur);
                    printf("\nest-ce le bon film? ");
                    scanf(" %c",&rep);
                    if(rep=='o'||rep=='O')
                    {
                        a.supp=1;
                        fseek(f,-1*sizeof(a),SEEK_CUR);flag=1;
                        fwrite(&a,sizeof(a),1,f);
                    } 
 
                    else
                        fread(&a,sizeof(a),1,f);
 
                }
                else
                    fread(&a,sizeof(a),1,f);
            }
            else
                fread(&a,sizeof(a),1,f);
 
        }   
        fclose(f);
 
        if(flag==0)
            printf("\nfilm absent");
    }
    else
        printf("\nerreur");
}

Et voici l'erreur qu'il m'affiche :
C:\Users\maverick\Desktop\ProjetenlangageC.cpp In function 'void changer(char*)':
198 41 C:\Users\maverick\Desktop\ProjetenlangageC.cpp [Warning] overflow in implicit constant conversion [-Woverflow]

l'erreur vient apparemment de la ligne 198 mais je n'arrive pas à trouver c'est quoi...

Merci d'avance a ceux qui prendront le temps de regarder