bonjour

Dans ce programme lorsque je crée le fichier:'C:\gestion\etudiant.dat'. L'ordinateur affiche le programme n'est pas crée! or dans le fichier j'ai inseré des informations dans le fichier.
Et lorsque je reexecute le programme, les informations reviennent.
comment faire? merci




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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
program Gestion_Etudiants;
 
uses crt,dos;   {declaration de la bibliotheque graphique et sonore}
 
type etudiant=record	{declaration de type pour l'enregistrement}
                 matricule:longint;
                 nom:string;
                 prenom:string;
                   sexe:char;
                 classe:string;
                        end;
 
var         {declaration des variables du programme principale}
 
       etud:file of etudiant;
          e:etudiant;
           y,m, d, dow : Word;
                      b:Boolean;
                      ch:integer; {choix pour les menus}
                      num:integer; {pour la boucle_for }
                        i:integer;
                     code:string;
                     admin:string;
            nom,prenom,sur:string;
 
const {declaration des constantes}
	code_admin='pigier';
	fichier='C:\gestion\etudiant.dat';
 
 {############################################################################}
procedure boucle_for(var num:integer);
var
      i:integer;
BEGIN
     for i:=1 to num do writeln;
END;
 
 
procedure creation_fichier;
var
      erreur:integer;
begin
    {creation du repertoire}
   {$I-}     {ici on evite d'arreter le prog si erreur!}
   MkDir('C:\gestion');
  {creation du fichier eleves.dat}
   Assign(etud,fichier);
   rewrite (etud);
   {$I+}
   erreur:=IOResult;
  if erreur <> 0 then
   begin
        writeln('Fichier deja creer');
         writeln('Ecrasement du fichier !');
        readln;
   end;
END;
 
                       {-----CREATION D'UNE FICHE ETUDIANT-----}
 
procedure ajout_fiche_etudiant;
 
var      num :integer;
         rep:string;
         erreur:integer;
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
     	seek(etud,FileSize(etud));
     	With e do begin
                 {repeat}
           		clrscr;
       	    		writeln('CREATION D''UNE FICHE ETUDIANT :':50);
           		writeln('*****************************':50);
           		num:=5;boucle_for(num);
              repeat
              write('Matricule : ');readln(matricule);
             {until(length(matricule)=6);}
             	write('Nom    : ');readln(nom);
           		writeln;
           		write('Prenom : ');readln(prenom);
           		writeln;
                write('sexe   : ');      readln(sexe);
                writeln;
           		write('classe : ');readln(classe);
           		writeln;
             	clrscr;
           		writeln('VERIFICATION DES DONNEES :':50);
           		writeln('**************************':50);
           		num:=3;
           		boucle_for(num);
                writeln('Matricule         : ':6,matricule);
                writeln;
           		writeln('Nom               : ':25,nom);
           		writeln;
           		writeln('Prenom            : ':25,prenom);
           		writeln;
           		writeln('Sexe              : ':1,sexe);
           		writeln;
                writeln('Classe            : ':25,classe);
           		writeln;
             	num:=2;boucle_for(num);
           		writeln('Etes-vous sur des donnees (o/n):':50);
           		write('reponse :');
           		readln(rep);
    		until ((rep='o') or (rep='oui') or (rep='Oui') or (rep='OUI'));
    		write(etud,e);
    	end;
    end;
END;
 
         {**********************-----CONSULTATION INFOS ELEVE-----**********************}
 
 
 
procedure recherche_info_etudiant;
var
      m, i:integer;
       n,p:string;nbre:integer;
      trouve:boolean;erreur:byte;choix:integer;choix2:string;
 
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
 
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
       clrscr;
       writeln('RECHERCHE DANS LA BASE DE DONNEE :':50);
       writeln;writeln;writeln;writeln;writeln;writeln;
   write('Matricule  : ':20);
       readln(m);
       write('NOM    : ':20);
       readln(n);
       write('PRENOM : ':20);
       readln(p);
       nbre:=-1;trouve:=false;
       while not eof(etud) and not trouve do begin
       		read(etud,e);
       		nbre:=nbre+1;
       		If ((n=e.nom) and (p=e.prenom) and (m=e.matricule)) then trouve:=true;
       end;
       If trouve then
       begin
       		seek(etud,nbre);
       		read(etud,e);
       		with e do
       		begin
       			repeat
                               repeat
                                  clrscr;
                                  writeln('INFORMATIONS SUR L''ELEVE :':52);
                                  writeln('***************************':52);
                                  writeln;writeln;writeln;
                                  for i:=1 to 5 do
                                  begin
                                  	write('':25);write(i);write(' : ');
                                  	case (i) of
                                        1:writeln('matricule         : ',matricule);
                                  		2:writeln('Nom               : ',nom);
                                  		3:writeln('Prenom            : ',prenom);
                                  		4:writeln('Sexe              : ',sexe);
                                  		5:writeln('Classe            : ',classe);
                                       	end;
                                  end;
                                  writeln;
                                  write('':25);writeln('6 : ','Revenir au menu');
                                  writeln;writeln;
                                  write('Information a modifier : ':25);readln(choix);
                               until ((choix>0) and (choix<7));
                               if choix<>6 then
                               begin
                                 repeat
                                  clrscr;
                                  write('':25);
                                  case (choix) of
                                        1:writeln('matricule         : ',matricule);
                                  		2:writeln('Nom               : ',nom);
                                  		3:writeln('Prenom            : ',prenom);
                                  		4:writeln('Sexe              : ',sexe);
                                  		5:writeln('Classe            : ',classe);
                                  	end;
                                  writeln;writeln;writeln;writeln;
                                  writeln('Voulez vous changer l''information (o/n) ?');
                                  write('Choix : ');readln(choix2);
                                 until ((choix2='o') or (choix2='n'));
                                  if choix2='o' then
                                  begin
                                  	writeln;writeln;write('':25);
                                  	case (choix) of
                                        1:begin;write('Matricule         : ');readln(matricule);end;
                                  		2:begin;write('Nom               : ');readln(nom);end;
                                  		3:begin;write('Prenom            : ');readln(prenom);end;
                                  		4:begin;
                                                        repeat;
                                                               write('Sexe : ');
                                                               readln(sexe);
                                                        until( (sexe='M') or (sexe='F'));
                                                end;
                                  		5:begin;
                                              repeat;
                                                 write('Classe           : ');
                                                    readln(classe);
                                                   until((length(classe)< 6) and (length(classe)>0));
                                                   end;
                                      end;
                                  	seek(etud,nbre);
                                  	write(etud,e);
                                  end;
                               end;
                        until (choix=6);
       		end;
       	end
       	else
       	begin
       		writeln;writeln;writeln;
     		writeln('L"eleve que vous avez indique n"est pas repertorie dans la base de donnees');
     		writeln('Il faut tout d"abord creer une fiche dans la base de donnees');
     		writeln;writeln;writeln;writeln;
     		writeln('[ENTRER]':45);
     		readln;
     	end;
       	close(etud);
 
      end;
END;
 
   {**********************-----SUPPRIMER UNE FICHE ELEVE-----**********************}
 
 
procedure supprimer_fiche_etudiant;
var
   i:integer;
   n,p:string;
   m,nbre:integer;
   trouve:boolean;
   erreur:integer;
   choix:string;
 
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
       clrscr;
       writeln('RECHERCHE DANS LA BASE DE DONNEE :':50);
       writeln;writeln;writeln;writeln;writeln;writeln;
  write('MATRICULE   : ':20);
       readln(m);
       write('NOM    : ':20);
       readln(n);
       write('PRENOM : ':20);
       readln(p);
       nbre:=-1;trouve:=false;
       while not eof(etud) and not trouve do begin
       		read(etud,e);
       		nbre:=nbre+1;
       		If ((n=e.nom) and (p=e.prenom) and (m=e.matricule) )then trouve:=true;
       end;
       If trouve then
       begin
       		seek(etud,nbre);
       		read(etud,e);
       		with e do
       		begin
                               repeat
                                  clrscr;
                                  writeln('FICHE EN COUR DE SUPPRESSION :':52);
                                  writeln('******************************':52);
                                  writeln;writeln;writeln;
                                  for i:=1 to 5 do
                                  begin
                                  	write('':25);
                                  	case (i) of
 
                                        1:writeln('matricule         : ',matricule);
                                  		2:writeln('Nom               : ',nom);
                                  		3:writeln('Prenom            : ',prenom);
                                  		4:writeln('Sexe              : ',sexe);
                                  		5:writeln('Classe            : ',classe);
                                  	end;
                                  end;
                                  writeln;
                                  writeln;writeln;
                                  write('Voulez-vous vraiment effacer cette fiche (o/n)? ':25);readln(choix);
                               until ((choix='o') or (choix='n'));
                               if choix='o' then
                               begin
                                    {matricule:='';}
                                  	      nom:='';
                                  	    prenom:='';
                                  	    {  sexe:=''; }
                                 	     classe:='';
                                   	seek(etud,nbre);
                                  	write(etud,e);
                           		end;
                  end;
       	end
       	else
       	begin
       		writeln;writeln;writeln;
     		writeln('L"eleve que vous avez indique n"est pas repertorie dans la base de donnees');
     		writeln('Il faut tout d"abord creer une fiche dans la base de donnees');
     		writeln;writeln;writeln;writeln;
     		writeln('[ENTRER]':45);
     		readln;
     	end;
       	close(etud);
 
      end;
END;
procedure affichage;
var
{i:integer;n,p,nom_a,prenom_a,choix2:string;choix:integer;  }
erreur:integer;{trouve:boolean;}
 
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
     		while not eof(etud) do begin
     			with e do begin
     				read(etud,e);
                    writeln(matricule);
     				writeln(nom);
     				writeln(prenom);
                    writeln(sexe);
     				writeln(classe);
                   readln;
     			end;
     		end;
     	end;
END;
 
 
 
                     {**********************-----RECHERCHE PAR NOM-----**********************}
 
 
procedure recherche_nom_etudiant;
var
   i,erreur:integer;
   n:string;
   nbre,nbre_trouve:integer;
   place:array[1..999] of integer;
   trouve:boolean;
   BEGIN
    {$I-}
     Assign(etud,fichier);
      reset(etud);
      {$I+}
       erreur:=IOResult;
     if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
      end
      else begin
       clrscr;
         writeln('RECHERCHE PAR NOM DANS LA BASE DE DONNEE :':60);
          writeln('******************************************':60);
          writeln;writeln;writeln;writeln;writeln;
          write('NOM    : ':20);
           readln(n);
          nbre:=-1;
          trouve:=false;
          nbre_trouve:=0;
         while not eof(etud) do begin
       		read(etud,e);
       		nbre:=nbre+1;
       		If ((n=e.nom)) then
              begin
                            nbre_trouve:=nbre_trouve+1;
                             place[nbre_trouve]:=nbre;
               end;
       end;
       writeln;writeln;write('':18);
       if nbre_trouve=0 then writeln('Aucun eleve n"a ete trouve dans notre fichier.')
                        else
                        if (nbre_trouve=1) then
                        writeln(nbre_trouve,' Eleve trouve correspond a la recherche.')
                       else
                       writeln(nbre_trouve,' Eleves trouves correspondent a la recherche.');
       writeln;writeln;readln;clrscr;
       if nbre_trouve<>0 then
          for i:=1 to nbre_trouve do
           begin
            seek(etud,place[i]);
            read(etud,e);
            with e do
            begin
                 clrscr;
                 writeln;
                 write('':35);
                 writeln('ELEVE Nø=',i);
                 writeln;
                 writeln;
                 writeln('Matricule     : ':20,matricule);
            writeln ('Nom               : ':25,nom);
           	 writeln('Prenom            : ':25,prenom);
           	 writeln('Sexe              : ':25,sexe);
           	 writeln('Classe            : ':25,classe);
 
           	 writeln;writeln;
                 write('':15);
           	   if i<>nbre_trouve then
                   writeln('APPUYER SUR [ENTER] POUR PASSER AU SUIVANT !')
                 		   else
                       writeln('APPUYER SUR [ENTER] POUR TERMINER':45);
                 readln;
            end;
       end;
     end;
END;
                               {**********************-----RECHERCHE PAR MATRICULE-----**********************}
 
 
 
procedure recherche_matricule_etudiant;
var
  m, i:integer;
   nbre,nbre_trouve:integer;
   place:array[1..999] of integer;
   trouve:boolean;
   erreur:integer;
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
       clrscr;
       writeln('RECHERCHE PAR MATRICULE DANS LA BASE DE DONNEE :':74);
       writeln('**************-----------------*************************':74);
       writeln;writeln;writeln;writeln;writeln;
       write('MATRICULE   : ':20);
       readln(m);
       nbre:=-1;
       trouve:=false;
       nbre_trouve:=0;
       while not eof(etud) do begin
       		read(etud,e);
       		nbre:=nbre+1;
       		If ((m=e.matricule)) then begin
                                         nbre_trouve:=nbre_trouve+1;
                                         place[nbre_trouve]:=nbre;
                                    end;
       end;
       writeln;writeln;write('':18);
       if nbre_trouve=0 then writeln('Aucun eleve n"a ete trouve dans notre fichier.')
                        else if (nbre_trouve=1) then writeln(nbre_trouve,' Eleve trouve correspond a la recherche.')
                                                else writeln(nbre_trouve,' Eleves trouves correspondent a la recherche.');
       writeln;writeln;readln;clrscr;
       if nbre_trouve<>0 then
       for i:=1 to nbre_trouve do
       begin
            seek(etud,place[i]);
            read(etud,e);
            with e do
            begin
                 clrscr;
                 writeln;
                 write('':35);
                 writeln('ELEVE Nø=',i);
                 writeln;
                 writeln;
                  writeln('Matricule  : ':25,matricule);
                   writeln('Nom       : ':25,nom);
                 writeln('Prenom      : ':25,prenom);
           	          writeln('Sexe   : ':25,sexe);
                   writeln('Classe    : ':25,classe);
 
           	 writeln;writeln;
                 write('':15);
           	 if i<>nbre_trouve then writeln('APPUYER SUR [ENTER] POUR PASSER AU SUIVANT !')
                 		   else writeln('APPUYER SUR [ENTER] POUR TERMINER':45);
                 readln;
            end;
       end;
     end;
END;
 
 
		{**********************-----RECHERCHE PAR CLASSE-----**********************}
 
 
 
procedure recherche_classe_etudiant;
var
     i,erreur:integer;
     c:string;
     nbre,nbre_trouve:integer;
     place:array[1..999] of integer;
     trouve:boolean;
     choix:string;
 
BEGIN
    {$I-}
    Assign(etud,fichier);
    reset(etud);
    {$I+}
    erreur:=IOResult;
    if erreur<> 0 then begin
        clrscr;writeln('Le fichier n"est pas cree');readln;
     end
     else begin
       clrscr;
       writeln('RECHERCHE PAR CLASSE DANS LA BASE DE DONNEE :':74);
       writeln('**************-----------------*************************':74);
       writeln;writeln;writeln;writeln;writeln;
       write('CLASSE   : ':20);
       readln(c);
       nbre:=-1;
       trouve:=false;
       nbre_trouve:=0;
       while not eof(etud) do begin
       		read(etud,e);
       		nbre:=nbre+1;
       		If ((c=e.classe)) then begin
                                         nbre_trouve:=nbre_trouve+1;
                                         place[nbre_trouve]:=nbre;
                                    end;
       end;
       writeln;writeln;write('':18);
       if nbre_trouve=0 then
       writeln('Aucun eleve n"a ete trouve dans notre fichier.')
                        else
                        if (nbre_trouve=1) then
                        writeln(nbre_trouve,' Eleve trouve correspond a la recherche.')
                                   else writeln(nbre_trouve,' Eleves trouves correspondent a la recherche.');
       writeln;writeln;readln;clrscr;
       if nbre_trouve<>0 then
       for i:=1 to nbre_trouve do
       begin
            seek(etud,place[i]);
            read(etud,e);
            with e do
            begin
                 clrscr;
                 writeln;
                 write('':35);
                 writeln('ELEVE Nø=',i);
                 writeln;
                 writeln;
                  writeln('Matricule  : ':25,matricule);
                   writeln('Nom       : ':25,nom);
                 writeln('Prenom      : ':25,prenom);
           	          writeln('Sexe   : ':25,sexe);
                   writeln('Classe    : ':25,classe);
 
           	 writeln;writeln;
                 write('':15);
           	 if i<>nbre_trouve then writeln('APPUYER SUR [ENTER] POUR PASSER AU SUIVANT !')
                 		   else writeln('APPUYER SUR [ENTER] POUR TERMINER':45);
                 readln;
            end;
       end;
     end;
END;
 
{############################################################################}
{###########################  MENUS  ########################################}
{############################################################################}
 
 
procedure menu_princ(var ch:integer);
BEGIN
     clrscr;
     writeln;
     textcolor(red);
     writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»':45);
     write('º  ':29);textcolor(green+blink);
     write('MENU PRINCIPAL');textcolor(red);
     writeln(' º');
     writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍO':45);
     textcolor(white);
     num:=5;
     boucle_for(num);
     writeln('':25,'1 : Gestion fiche etudiant');
     writeln('':25,'2 : Consultation fiche etudiant');
     writeln('':25,'3 : Quitter');
     boucle_for(num);
     write('CHOIX : ':2);
     readln(ch);
END;
 
procedure menu_1(var ch:integer);
BEGIN
     clrscr;
     writeln;
     textcolor(red);
     writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»':45);
     write('º  ':31);textcolor(green+blink);
     write('MENU GESTION');textcolor(red);
     writeln(' º');
     writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍO':45);
     textcolor(white);
     num:=3;
     boucle_for(num);
     writeln('':25,'1 : Creation d"une fiche etudiant');
     writeln('':25,'2 : modification d"une fiche etudiant');
     writeln('':25,'3 : Supprimer une fiche');
     writeln('':25,'4 : Menu precedent');
     writeln('':25,'5 : Quitter');
     boucle_for(num);
     write('CHOIX : ':2);
     {$I-}
     readln(ch);
     {$I+}
END;
 
procedure menu_2(var ch:integer);
BEGIN
     clrscr;
     writeln;
     textcolor(red);
     writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»':45);
     write('º  ':26);textcolor(green+blink);
     write('MENU CONSULTATION');textcolor(red);
     writeln(' º');
     writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍO':45);
     textcolor(white);
     num:=5;
     boucle_for(num);
     writeln('':25,'1 : Recherche d"un etudiant');
     writeln('':25,'2 : Menu precedent');
     writeln('':25,'3 : Quitter');
     boucle_for(num);
     write('CHOIX : ':2);
     readln(ch);
END;
 
procedure menu_setup(var ch:integer);
BEGIN
     clrscr;
     writeln;
     textcolor(red);
     writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»':45);
     write('º  ':32);textcolor(green+blink);
     write('MENU SETUP ');textcolor(red);
     writeln(' º');
     writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍO':45);
     textcolor(white);
     num:=5;
     boucle_for(num);
     writeln('':25,'1 : Creation et initialisation du fichier.');
     writeln('':25,'2 : Annuler.');
     writeln('':25,'3 : Quitter.');
     boucle_for(num);
     write('CHOIX : ':2);
     readln(ch);
END;
 
procedure menu_3(var ch:integer);
BEGIN
     clrscr;
     writeln;
     textcolor(red);
     writeln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»':45);
     write('º  ':26);textcolor(green+blink);
     write(' MENU  RECHERCHE ');textcolor(red);
     writeln(' º');
     writeln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍO':45);
     textcolor(white);
     num:=5;
     boucle_for(num);
     writeln('':25,'1 : Recherche par Nom');
     writeln('':25,'2 : Recherche par Matricule');
     writeln('':25,'3 : Recherche par Classe');
     writeln('':25,'4 : Recherche par Sexe');
     writeln('':25,'5 : Menu precedent');
     writeln('':25,'6 : Quitter');
     boucle_for(num);
     write('CHOIX : ':2);
     readln(ch);
END;
{############################################################################}
{#############################  PROG PRINCIPAL  #############################}
{############################################################################}
{############################################################################}
 
 
 
BEGIN
textcolor(white);
clrscr;
repeat
      admin:='';
      menu_princ(ch);
      case ch of
           1:begin
             repeat
              clrscr;
              num:=8;
              boucle_for(num);
              if admin<>'pigier' then begin
              write('CODE ADMINISTRATEUR : ':50);readln(admin);
              end;
              if admin=code_admin then
               begin
                 repeat
                  menu_1(ch);
                  case ch of
 
                       1:ajout_fiche_etudiant;
                       2:recherche_info_etudiant;
                       3:supprimer_fiche_etudiant;
                       4:begin
                              ch:=0;
                              admin:='';
                       end;
                       5:exit;
                  end;
                 until ((ch=0) or (ch=1) or (ch=2) or (ch=3) or (ch=4) or (ch=5)  );
               end
              else
               begin
                 num:=5;
                 boucle_for(num);
                 textcolor(red+blink);
                 writeln('MOT DE PASS ERRONER !!!':55);
                 textcolor(white);
                 delay(2000);
               end;
             until admin<>'pigier';
             end;
           2:begin
                 repeat
                  menu_2(ch);
                  case ch of
                       1:begin
                       		repeat
                       		  menu_3(ch);
                       		  case ch of
                       		  	1:begin;recherche_nom_etudiant;ch:=7;end;
                       		  	2:begin;recherche_matricule_etudiant;ch:=7;end;
                       		  	3:begin;recherche_classe_etudiant;ch:=7;end;
                       		  	4:begin;ch:=7;end;
                       		  	5:ch:=5;
                       		  	6:exit;
                       		  end;
                       		until ((ch=0) or (ch=1) or (ch=2) or (ch=3) or (ch=4) or (ch=5) or (ch=6));
                       	end;
                       2:ch:=0;
                       3:exit;
                  end;
                 until ((ch=0) or (ch=1) or (ch=2) or (ch=3)  or (ch=4))
             end;
           3:exit;
           999:begin {menu caché par l'administrateur}
                    writeln('Etes-vous sur de vouloir lancer le setup?');
                    writeln('Ceci efface toutes les donnees enregistrees!!');
                    write('Sur (Oui) ? ');readln(sur);
                    if sur='Oui' then begin
                                        repeat
                                         menu_setup(ch);
                                         case ch of
                                              1:creation_fichier;
                                              2:ch:=0;
                                              3:exit;
                                         end;
                                        until ((ch=0) or (ch=1) or (ch=2) or (ch=3))
                                    end;
               end;
          end;
until ch=3;
 
 
END.