SHARE
TWEET

Untitled

a guest Dec 10th, 2018 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program rec;
  2.  
  3. uses crt;
  4.  
  5. type
  6.   oz = array[1..3] of integer;
  7.   student = record
  8.     name: string;
  9.     family: string;
  10.     lastname: string;
  11.     year: string;
  12.     group: string;
  13.     ot: array[1..3] of string;
  14.     srball: double;
  15.     o: oz;
  16.     status: string
  17.   end;
  18.   sts = array[1..4] of student;
  19.  
  20. var
  21.   n: integer;
  22.   st: sts;
  23.   error: integer;
  24.   c: char;
  25.   csharp, cspace: integer;
  26.   top: array[1..3] of double;
  27.   y, x: integer;
  28.   temp: student;
  29.   i,r: integer;
  30.  
  31. begin
  32.   n := 4;
  33.  
  34.   for csharp := 1 to n do
  35.   begin
  36.     st[csharp].family := '';
  37.     st[csharp].name := '';
  38.     st[csharp].lastname := '';
  39.     st[csharp].year := '';
  40.     st[csharp].group := '';
  41.     st[csharp].ot[1] := '';
  42.     st[csharp].ot[2] := '';
  43.     st[csharp].ot[3] := '';
  44.     st[csharp].status := '';
  45.   end;
  46.  
  47.  
  48.   csharp := 1;
  49.   cspace := 0;
  50.  
  51.   while (csharp < n + 1) do
  52.   begin
  53.     c := readkey();
  54.     write(c);
  55.     case c of
  56.       ' ':
  57.         begin
  58.           cspace := cspace + 1;
  59.         end;
  60.       ';':
  61.         begin
  62.           cspace := 0;
  63.           csharp := csharp + 1;
  64.           writeln();
  65.         end
  66.     else
  67.       begin
  68.         case cspace of
  69.           0: st[csharp].family := st[csharp].family + c;
  70.           1: st[csharp].name := st[csharp].name + c;
  71.           2: st[csharp].lastname := st[csharp].lastname + c;
  72.           3: st[csharp].year := st[csharp].year + c;
  73.           4: st[csharp].group := st[csharp].group + c;
  74.           5: st[csharp].ot[1] := st[csharp].ot[1] + c;
  75.           6: st[csharp].ot[2] := st[csharp].ot[2] + c;
  76.           7: st[csharp].ot[3] := st[csharp].ot[3] + c;
  77.           8: st[csharp].status := st[csharp].status + c;
  78.         end;
  79.       end;
  80.     end;
  81.   end;
  82.  
  83.   for csharp := 1 to n do
  84.   begin
  85.     Val(st[csharp].ot[1], st[csharp].o[1], error);
  86.     Val(st[csharp].ot[2], st[csharp].o[2], error);
  87.     Val(st[csharp].ot[3], st[csharp].o[3], error);
  88.   end;
  89.  
  90.     top[1] := 0;
  91.   top[2] := 0;
  92.   top[3] := 0;
  93.   for i := 1 to n do
  94.   begin
  95.     top[1] := top[1] + st[i].o[1];
  96.     top[2] := top[2] + st[i].o[2];
  97.     top[3] := top[3] + st[i].o[3];
  98.   end;
  99.   top[1] := top[1] / n;
  100.   top[2] := top[2] / n;
  101.   top[3] := top[3] / n;
  102.   for y := 1 to n - 1 do
  103.   begin
  104.     for x := y + 1 to n do
  105.     begin
  106.       if st[y].family > st[x].family then
  107.       begin
  108.         temp := st[y];
  109.         st[y] := st[x];
  110.         st[x] := temp;
  111.       end;
  112.     end;
  113.   end;
  114.  
  115.   println();
  116.   println('Sort:');
  117.   for x := 1 to n do
  118.   begin
  119.     println(st[x].family, ' - ', st[x].o[1], st[x].o[2], st[x].o[3]);
  120.   end;
  121.   println();
  122.   println('Math:', top[1]);
  123.   println('Phys:', top[2]);
  124.   println('Prog:', top[3]);
  125.   println();
  126.  
  127.    
  128.   print('Top: ');
  129.   if top[1] > top[2] then
  130.   begin
  131.     if top[1] > top[3] then
  132.     begin
  133.       print('Math');
  134.     end
  135.     else
  136.       print('Prog');
  137.   end
  138.   else
  139.   begin
  140.     if top[2] > top[3] then
  141.     begin
  142.       print('Phys');
  143.     end
  144.     else
  145.       print('Prog');
  146.   end;
  147.   println();
  148.  
  149. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top