Bonjour,

on m'a demandé de faire un programme sur 5O étudiants. On a leurs moyennes et 3 choix et on veut les orienter vers des filières.

Si quelqu'un peut m'aider sur le test. Normalement on prend son premier choix et on voit si sa moyenne est supérieure ou égale à la moyenne minimum de la filière et si le nombre d'étudiants ne dépasse pas la capacité de la filière.

Que me conseillez-vous ?

P.S. : je suis en première année et c'est mon premier programme.

Voilà le programme :
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
program Untitled;
uses crt,wincrt ;
const nb = 50 ;
 
type etudiant =   record
             nom , prenom:string; 
             moy: real;
             choix1, choix2 ,choix3,D : integer;   // D 1= admis
              end;
 
 type filiere =   record
             nom :string;
             moy_min: real;
             nb, cap : integer;
              end;
 
 
 
var  tab1: array [ 1 .. nb]of etudiant;
     tab2: array [ 1 .. 5]of filiere;
 
 
  i,j : integer;
 
 // les filieres   math_info 1 ,science et technique 2 , medcine 3 , pharmacie 4,  chirurgie dentaire 5
 
 //****************************************
 procedure remplissage1;
begin
// LES INFO DE CHAQUE ELEVE
    for i := 1 to nb do
   begin
   TextColor(LightMagenta);
   writeln(Chr(144),'tudiant nø ', i);
  TextColor(white);
   write(' Nom: ');
   readln (tab1[i].nom);
    write(' Pr',Chr(130),'nom: ');
   readln ( tab1[i].prenom);
    write(' Entres ta moy',Chr(138),'nne ');
   readln ( tab1[i].moy);
    writeln(' Entres tes choix ');
    write('choix 1: ');
     read ( tab1[i].choix1);
     write('choix 2: ');
     read ( tab1[i].choix2);
     write('choix 3: ');
     readln ( tab1[i].choix3);
     writeln('D',Chr(130),'cision ');
     tab1[i].D:= 0 ;
     TEXTCOLOR(LightCyan);
     writeln('************* ');
 
  end;
 end;
//****************************************
  procedure remplissage2;
  begin
 for j := 1 to 5 do
   begin
     TextColor(LightMagenta);
    writeln('fili',Chr(138),'re nø ', j);
    TextColor(white);
    writeln(' Entres le nom du fili',Chr(138),'re  ');
   readln (tab2[j].nom);
    writeln(' Entres la moy',Chr(138),'nne minimum ');
   readln (tab2[j].moy_min);
    writeln(' Entres le nombre d''',Chr(130),'l',Chr(138),'ve possible  ');
      readln (tab2[j].cap);
     writeln(' Le nombre  ');
     tab2[j].nb:=0 ;
      TEXTCOLOR(LightCyan);
     writeln('************* ');
     end;
     TextColor(white);
  end;
 //****************************************
  procedure affichage1;
  begin
  for i:= 1 to nb do
   begin
   TextColor(LightMagenta);
 writeln(Chr(144),'tudiant nø ', i);
   TextColor(white);
       write('| Nom:',tab1[i].nom ,' | ') ;
       write( 'Pr',Chr(130),'nom:',tab1[i].prenom, ' | ');
       write('Moy',Chr(138),'nne:',tab1[i].moy:4:2,' | ');
       write('choix1:',tab1[i].choix1,' | ');
       write( 'choix2:', tab1[i].choix2,' | ' );
       writeln('choix3:',tab1[i].choix3,' | ');
       TEXTCOLOR(LightCyan);
       writeln('************* ');
       TextColor(white);
    end;
  end;
  //****************************************
  procedure affichage2;
  begin
  for j:=1  to 5 do
   begin
   TextColor(LightMagenta);
   writeln(' filiere n ', j);
   TextColor(white);
   writeln('le nom du fili',Chr(138),'re: ',tab2[j].nom) ;
   writeln( 'la capacit',Chr(130),'e: ',tab2[j].cap );
   writeln('la moy',Chr(138),'nne min: ',tab2[j].moy_min :4:2);
   writeln('le nombre d''',Chr(130),'l',Chr(138),'ves: ',tab2[j].nb);
    TEXTCOLOR(LightCyan);
   writeln('************* ');
    end;
    end;
  //****************************************
    procedure moy;
 
   begin
     TextColor(LightMagenta);
     writeln (' les moy',Chr(138),'nnes de tout les ',Chr(130),'l',Chr(138),'ves:');
      textColor(white);
      write('| '); 
        for i:= 1 to nb do
        write( tab1[i].moy :4:2, ' | ') ;
 
    end;
 
  // LE TRI :
  procedure permutr( var x, y : real);
var z : real;
begin 
z:=x; 
x:=y; 
y:=z; 
end;
//*********
     procedure permutst( var x, y : string);
var z : string;
begin 
z:=x; 
x:=y; 
y:=z; 
end;
//*********
      procedure permuti( var x, y : integer);
var z :integer;
begin 
z:=x; 
x:=y; 
y:=z; 
end;
//*********
 
   procedure tri;
 var K,i: integer;
     test: boolean;
begin
     K:=1;
 
    repeat
    test:=false;
    for i:=1 to nb-K do
       begin
       if tab1[i].moy < tab1[i+1].moy then
          begin
          permutr (tab1[i].moy ,tab1[i+1].moy);
          permutst (tab1[i].nom ,tab1[i+1].nom);
          permutst (tab1[i].prenom ,tab1[i+1].prenom);
          permuti (tab1[i].choix1 ,tab1[i+1].choix1);
          permuti (tab1[i].choix1 ,tab1[i+1].choix1);
          permuti (tab1[i].choix1 ,tab1[i+1].choix1);
          permuti (tab1[i].D ,tab1[i+1].D);
          test:=true;
          end;
       end;
    K:=K+1;
    until test=false;
end;
 
 
 
 
 // **********
 procedure affichage_tri;
var
    i:integer;
 
begin
 writeln;
  TextColor(LightMagenta);
 
  WriteLn('||         les moy',Chr(138),'nnes de tout les ',Chr(130),'l',Chr(138),'ves avec un tri             ||');
 
 
   textColor(white);
 write('| '); 
  for i:=1 to nb do
   write(tab1[i].moy:4:2,' | ');
   TEXTCOLOR(LightCyan);
    writeln;
   writeln('************* ');
   TextColor(white);
 
end;
// LE TEST
 procedure test ;
 var
  begin
 
 
  end;
// le programe
 
 begin
 
 remplissage1;
 remplissage2;
 clrscr;
 affichage1;
 affichage2;
 moy;
 tri;
affichage_tri;
affichage1;
 test;
 
 readln;
 
end.