Accueil     Soft. MacOSX     Soft. MacOS/PC     PHP     Python     ROMS GBA     TP d'info     DBZ-GT     Martingales     Galeries     Liens     @  

Exercice 5

program exo5;
const
n = 25; { 25 etudiants }
m = 5; { 5 matieres }
var
i, j, k, ds: integer;
mention: array[1..4, 1..2] of integer;
tab: array[1..n, 1..m] of integer;

function rand (minimum, maximum: integer): integer;
begin
rand := minimum + Abs(Random) mod (maximum - minimum + 1);
end;
{ Fin de la fonction 'rand' }


begin
{ corps du programme }
writeln('©2001 All Rights Reserved to www.Software-DS.com');

for i := 1 to n do
{ On genere des notes aleatoires }
for j := 1 to m do
tab[i, j] := rand(0, 20);

writeln;
for i := 1 to n do
{ Calcul des moyennes des etudiants. }
begin
write('moyenne de l''etudiant ', i : 2, ' : ');
k := 0;
for j := 1 to m do
k := k + tab[i, j];
k := k div m;
writeln(k : 2);
end;

writeln;
for i := 1 to m do
{ Calcul de moyenne des matieres. }
begin
write('moyenne de la matiere ', i : 0, ' : ');
k := 0;
for j := 1 to n do
k := k + tab[i, j];
k := k div n;
writeln(k : 2);
end;

writeln;
{ Calcul des mentions ! }
mention[1, 1] := 5;
mention[1, 2] := 8;
mention[2, 1] := 8;
mention[2, 2] := 10;
mention[3, 1] := 10;
mention[3, 2] := 12;
mention[4, 1] := 14;
mention[4, 2] := 20;

for ds := 1 to 4 do
begin
write('Voici les etudiant(s) qui ont la mention: ');
if ds = 1 then
writeln('Tres faible.')
else if ds = 2 then
writeln('Moyen.')
else if ds = 3 then
writeln('Assez bien.')
else if ds = 4 then
writeln('Tres bien :-).');

for i := 1 to n do
{ Calcul de moyenne des etudiants. }
begin
k := 0;
for j := 1 to m do
k := k + tab[i, j];
k := k div m;
if (mention[ds, 1] <= k) and (mention[ds, 2] > k) then
write(i : 0, ',');
end;
writeln;
writeln;
end;

writeln;
writeln('©2001 All Rights Reserved to http://www.Software-DS.com');
{ ©2001 All Rights Reserved to http://www.Software-DS.com 09/10/01 }
end.





Haut de la page - Page précédente - Page générée en 0.01426 sec.
Recherche personnalisée
 

1843276 visiteurs.   ©2001-2023 All Rights Reserved to Software-DS.com
Made with a mac  
Confidentialité