Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program fucking_homework;
- uses
- crt;
- type
- array_horse = array[1..50] of integer;
- var
- horse : array_horse;
- i : integer;
- temp : integer;
- max : integer;
- procedure horse_input(var horse:array_horse);
- begin
- for i:=0 to 50 do
- begin
- writeln('0 to exit');
- write('Input the horse weight: ');
- readln(horse[i]);
- max := i;
- if horse[i] = 0 then break;
- writeln('The weight is: ', horse[i]);
- end;
- end;
- procedure horse_output(horse:array_horse; max:integer; var temp:integer);
- begin
- writeln('Choose the class');
- writeln('[0] Light (0 - 999 pounds)');
- writeln('[1] Standart (1000 - 1399 pounds)');
- writeln('[2] Draft (1400 pounds or heavier)');
- readln(temp);
- if temp = 0 then
- begin
- for i:=0 to max do
- begin
- if (horse[i] > 0) AND (horse[i] < 999) then writeln(horse[i]);
- end;
- end;
- if temp = 1 then
- begin
- for i:=0 to max do
- begin
- if (horse[i] > 1000) AND (horse[i] < 1399) then writeln(horse[i]);
- end;
- end;
- if temp = 2 then
- begin
- for i:=0 to max do
- begin
- if (horse[i] > 1400) then writeln(horse[i]);
- end;
- end;
- end;
- procedure horse_other(horse:array_horse);
- begin
- writeln('Total number of horse: ', max);
- for i:=0 to max do
- begin
- temp := temp + horse[i];
- end;
- writeln('Total weight: ', temp);
- writeln('Average weight: ', temp/max:0:2);
- end;
- begin
- clrscr;
- horse_input(horse);
- horse_output(horse, max, temp);
- horse_other(horse);
- end.
Add Comment
Please, Sign In to add comment