Ex 1
Ex 1
pas
Program ex1;
Uses Wincrt;
Type
eleve = Record
code: String;
nt: Real;
moy: Real;
np: Real;
End;
el = Record
code: String;
moy: Real;
End;
tabt = Array[1..9] Of eleve;
tabv = Array[1..9] Of el;
Var
t: tabt ;
v: tabv;
Procedure saisir (n:Integer);
Begin
Repeat
Writeln('saisire n :');
Read (n);
Until (n In [3..19]);
End;
Procedure remplir (n:Integer ; t: tabt);
Var
pr,nom: String;
i: Integer;
Begin
For i:=1 To n Do
With t[i] Do
Begin
Repeat
Writeln ('saisir le nom');
Readln(nom);
Writeln('saisir le prénom');
Readln(pr);
Until (Length(nom)>0) And (Length(pr)>0);
t[i].code := Copy(nom,1,2)+Copy(pr,Length(pr)-2,3);
Repeat
Writeln('saisir bote pratique:' );
Readln(t[i].np);
Until (t[i].np>=0) And (t[i].np>=20) ;
Repeat
Writeln('saisir bote theorique:' );
Readln(t[i].nt);
Until (t[i].nt>=0) And (t[i].nt>=20) ;
End;
End;
Function calcul(n:Integer;t:tabt): Real ;
Var
i,nb: Integer;
Begin
nb := 0 ;
For i:=1 To n Do
If (t[i].moy>=10)Then
nb := nb+1 ;
calcul := nb/n*100;
End;
Procedure transf (v:tabv;n:Integer;t:tabt;p:Integer);
Var
i: Integer;
Begin
p := 0 ;
For i:=1 To n Do
If (t[i].moy>=10)Then
Begin
p := p+1 ;
v[p].code := t[i].code;
v[p].moy := t[i].moy;
End;
End;
Procedure affiche (v:tabv;p:Integer);
Begin
r := Random(p)+1;
Write (v[r].moy);
End;
Begin
Procedure
End;
End.