Program S1;
Type
tab_s = array [1..100] Of string[8];
tab_e = array [1..100] Of integer;
Var
n, ad, i : integer;
tm : tab_s;
ts : tab_e;
//****************************************************
Procedure remplir(Var tm : tab_s ; Var ts : tab_e ; Var n :integer);
Var
v : longint;
e, i : integer;
Begin
Repeat
Write('Donner le nombre d''éléments [5..100] : ');
Readln(n);
Until (n >= 5) And (n <= 100);
For i:=1 To n Do
Begin
Writeln('Employé n°', i);
Repeat
Write('Matricule 8 chiffres : ');
Readln(tm[i]);
Val(tm[i], v, e);
Until (length(tm[i]) = 8) And (e = 0);
Repeat
Write('Score [20..100] : ');
Readln(ts[i]);
Until (ts[i] >= 20) And (ts[i] <= 100);
End;
End;
//****************************************************
Procedure tri(Var tm : tab_s ; Var ts : tab_e ; n : integer);
Var
i, j, auxi : integer;
auxs : string;
Begin
For i:=1 To n - 1 Do
For j:=1 To n-1 Do
If (ts[j+1] > ts[j]) Then
Begin
auxs := tm[j + 1];
tm[j + 1] := tm[j];
tm[j] := auxs;
auxi := ts[j + 1];
ts[j + 1] := ts[j];
ts[j] := auxi;
End;
End;
//****************************************************
Begin
Remplir(tm, ts, n);
Tri(tm, ts, n);
Writeln('Liste des admis');
ad := Round(n / 4);
For i:=1 To ad Do
Begin
Write(tm[i], ' ');
End;
End.
Inscription à :
Publier les commentaires (Atom)