0% found this document useful (0 votes)
23 views

Ex 1

The document is a Pascal program that defines record types for students and their grades, declares arrays to store student data, and includes procedures for inputting student data, calculating averages, transferring qualifying students to a new array, and displaying a random grade. It takes in student names, IDs, test scores, and calculates averages to determine if their grade qualifies for transfer to a separate array, from which a random grade will be displayed.

Uploaded by

Bilel Werghemmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Ex 1

The document is a Pascal program that defines record types for students and their grades, declares arrays to store student data, and includes procedures for inputting student data, calculating averages, transferring qualifying students to a new array, and displaying a random grade. It takes in student names, IDs, test scores, and calculates averages to determine if their grade qualifies for transfer to a separate array, from which a random grade will be displayed.

Uploaded by

Bilel Werghemmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C:\Users\HP\Desktop\ex1.

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.

08/11/2020 - 03:08:32 - Page 1/1

You might also like