Guest User

Untitled

a guest
Jan 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.51 KB | None | 0 0
  1. program fucking_homework;
  2. uses
  3.     crt;
  4. type
  5.     array_horse = array[1..50] of integer;
  6.  
  7. var
  8.     horse : array_horse;
  9.     i : integer;
  10.     temp : integer;
  11.     max : integer;
  12.  
  13. procedure horse_input(var horse:array_horse);
  14.     begin
  15.         for i:=0 to 50 do
  16.             begin
  17.                 writeln('0 to exit');
  18.                 write('Input the horse weight: ');
  19.                 readln(horse[i]);
  20.                 max := i;
  21.                 if horse[i] = 0 then break;
  22.                 writeln('The weight is: ', horse[i]);
  23.             end;
  24.     end;
  25.  
  26. procedure horse_output(horse:array_horse; max:integer; var temp:integer);
  27.     begin
  28.         writeln('Choose the class');
  29.         writeln('[0] Light (0 - 999 pounds)');
  30.         writeln('[1] Standart (1000 - 1399 pounds)');
  31.         writeln('[2] Draft (1400 pounds or heavier)');
  32.         readln(temp);
  33.         if temp = 0 then
  34.             begin
  35.                 for i:=0 to max do
  36.                     begin
  37.                         if (horse[i] > 0) AND (horse[i] < 999) then writeln(horse[i]);
  38.                     end;
  39.             end;
  40.         if temp = 1 then
  41.             begin
  42.                 for i:=0 to max do
  43.                     begin
  44.                         if (horse[i] > 1000) AND (horse[i] < 1399) then writeln(horse[i]);
  45.                     end;
  46.             end;
  47.         if temp = 2 then
  48.             begin
  49.                 for i:=0 to max do
  50.                     begin
  51.                         if (horse[i] > 1400) then writeln(horse[i]);
  52.                     end;
  53.             end;
  54.     end;
  55.  
  56. procedure horse_other(horse:array_horse);
  57.     begin
  58.         writeln('Total number of horse: ', max);
  59.         for i:=0 to max do
  60.             begin
  61.                 temp := temp + horse[i];
  62.             end;
  63.         writeln('Total weight: ', temp);
  64.         writeln('Average weight: ', temp/max:0:2);
  65.     end;
  66.  
  67. begin
  68.     clrscr;
  69.     horse_input(horse);
  70.     horse_output(horse, max, temp);
  71.     horse_other(horse);
  72. end.
Add Comment
Please, Sign In to add comment