Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Class5MXL;
- uses crt;
- const
- size=20;
- var
- nom,entry:string;
- amount, i,choose:integer;
- value:real;
- cours: array[1..size] of string;
- points: array[1..size] of real;
- procedure CalculerMoyenne;
- var
- a,b:real;
- i:integer;
- begin
- writeln('Calcul...');
- a:=0.0;
- b:=0.0;
- for i:=1 to length(cours) do begin
- if(not(cours[i]='')) then begin
- b:=b+1;
- a:=a+points[i];
- end;
- end;
- writeln('Votre moyenne est de ',(((a/b)) : 3 : 2),'% !');
- end;
- procedure AfficherUnCours;
- var
- find:boolean;
- begin
- writeln('Quelle cour voulez-vous trouver ?');
- write('--> ');
- readln(entry);
- while(length(entry) < 2) do begin
- writeln('Le cours doit faire au minimum 2 caractere !');
- write('--> ');
- readln(entry);
- end;
- find:=false;
- for i:=1 to length(cours) do begin
- if(cours[i]=entry)then begin
- find:=true;
- writeln('Vous avez ',(points[i]: 3 : 2),'% dans le cours de ',entry,' !');
- end;
- end;
- if(find=false) then writeln('Cours introuvable !');
- end;
- procedure AfficherCoursCotes;
- begin
- writeln('Cours: ');
- for i:=1 to size do begin
- if(not (cours[i]='')) then begin
- writeln(' ',cours[i],': ',(points[i]: 3 : 2),'%');
- end;
- end;
- writeln('rfebgrtsbnrtygnehndgehnegnedgr');
- end;
- procedure SaisirDonnees;
- begin
- writeln('--------- Exercice Cours - Moyenne ---------');
- write('Quelle est votre nom ? ');
- readln(nom);
- while(length(nom) < 2) do begin
- writeln('Votre nom est trop court ! (minimum 2 caracrtere)');
- write('Quelle est votre nom ? ');
- readln(nom);
- end;
- write('Combien avez-vous de cours ? ');
- readln(amount);
- while((amount < 2) or (amount > 100)) do begin
- if(amount < 2) then
- writeln('Vous devez avoir au moins 1 cour !')
- else
- writeln('Le nombre maximum de cours est de 20 (car lazarus ne suporte deja pas 100) !');
- write('Combien avez-vous de cours ? ');
- readln(amount);
- end;
- writeln('Initialisons vos donnees: ');
- for i:=1 to amount do begin
- write('Nom du cours: ');
- readln(entry);
- while((length(entry) < 2)) do begin
- if (length(entry) < 2) then
- writeln('Le nom du cours doit faire au moins 2 caractere !')
- else
- writeln('Ce cours a deja ete encoder !');
- write('Nom du cours: ');
- readln(entry);
- end;
- write('Pourcentage obtenu (%) : ');
- readln(value);
- while((value <= 0.0) or (value >= 100.0)) do begin
- writeln('pourcentage doit etre entre 0 et 100 !');
- write('Pourcentage obtenu (%) : ');
- readln(value);
- end;
- cours[i]:=entry;
- points[i]:=value;
- writeln('Encoder !');
- end;
- end;
- begin
- SaisirDonnees;
- repeat begin
- clrscr;
- writeln('--------- Exercice Cours - Moyenne ---------');
- writeln('(0 pour quitter)');
- writeln('Menu:');
- writeln('1. Afficher les cours et la cote obtenue');
- writeln('2. Chercher la note d''un cours en particulier');
- writeln('3. Calculer la moyenne de l''eleve');
- write('--> ');
- readln(choose);
- case choose of
- 1:AfficherCoursCotes;
- 2:AfficherUnCours;
- 3:CalculerMoyenne;
- end;
- writeln();
- writeln('Appuille sur entrer pour continuer...');
- readkey;
- end;
- until (choose < 1);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement