program ex1d;
const
nnotes = 3;
nfiches = 100;
type
fiche = record
num: integer;
nom: string;
groupe: char;
notes: array[1..nnotes] of real;
end;
pfiche = ^fiche;
session = array[1..nfiches] of pfiche;
var
pf: pfiche;
s: session;
ps: ^session;
i, j, compteur: integer;
begin
writeln('Exercice 1 d http://www.Software-DS.com');
new(ps);
for i := 1 to nfiches do {
Allocation }
new(ps^[i]);
for i := 1 to nfiches do {
initialisation des données }
begin
ps^[i]^.num := i;
ps^[i]^.nom := '----------';
ps^[i]^.groupe := '-';
for j := 1 to nnotes do
ps^[i]^.notes[j] := -1.0;
end;
compteur := 0;
for i := 1 to nfiches do {
Affichage }
begin
writeln('Classement:', ps^[i]^.num : 0, ' Nom:',
ps^[i]^.nom, ' Groupe:',
ps^[i]^.groupe);
for j := 1 to 3 do
write(' ', ps^[j]^.notes[j] : 0);
compteur := compteur + 1;
writeln;
if ((compteur mod 10) = 0) then
readln;
end;
for i := 1 to nfiches do {
désallocation Attention DANGER DE BUG ! }
dispose(ps^[i]);
{ Il faut
respecter un ordre pour désallouer }
dispose(ps);
{ On désalloue dans l'ordre inverse d'allouement: le
dernier alloué sera le premier
désalloué }
writeln;
writeln('©2001 All Rights Reserved to
www.Software-DS.com');
{ ©2001 All
Rights Reserved to http://www.Software-DS.com
23/10/01 }
end.
|