Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program rec;
- uses crt;
- type
- oz = array[1..3] of integer;
- student = record
- name: string;
- family: string;
- lastname: string;
- year: string;
- group: string;
- ot: array[1..3] of string;
- srball: double;
- o: oz;
- status: string
- end;
- sts = array[1..4] of student;
- var
- n: integer;
- st: sts;
- error: integer;
- c: char;
- csharp, cspace: integer;
- top: array[1..3] of double;
- y, x: integer;
- temp: student;
- i,r: integer;
- begin
- n := 4;
- for csharp := 1 to n do
- begin
- st[csharp].family := '';
- st[csharp].name := '';
- st[csharp].lastname := '';
- st[csharp].year := '';
- st[csharp].group := '';
- st[csharp].ot[1] := '';
- st[csharp].ot[2] := '';
- st[csharp].ot[3] := '';
- st[csharp].status := '';
- end;
- csharp := 1;
- cspace := 0;
- while (csharp < n + 1) do
- begin
- c := readkey();
- write(c);
- case c of
- ' ':
- begin
- cspace := cspace + 1;
- end;
- ';':
- begin
- cspace := 0;
- csharp := csharp + 1;
- writeln();
- end
- else
- begin
- case cspace of
- 0: st[csharp].family := st[csharp].family + c;
- 1: st[csharp].name := st[csharp].name + c;
- 2: st[csharp].lastname := st[csharp].lastname + c;
- 3: st[csharp].year := st[csharp].year + c;
- 4: st[csharp].group := st[csharp].group + c;
- 5: st[csharp].ot[1] := st[csharp].ot[1] + c;
- 6: st[csharp].ot[2] := st[csharp].ot[2] + c;
- 7: st[csharp].ot[3] := st[csharp].ot[3] + c;
- 8: st[csharp].status := st[csharp].status + c;
- end;
- end;
- end;
- end;
- for csharp := 1 to n do
- begin
- Val(st[csharp].ot[1], st[csharp].o[1], error);
- Val(st[csharp].ot[2], st[csharp].o[2], error);
- Val(st[csharp].ot[3], st[csharp].o[3], error);
- end;
- top[1] := 0;
- top[2] := 0;
- top[3] := 0;
- for i := 1 to n do
- begin
- top[1] := top[1] + st[i].o[1];
- top[2] := top[2] + st[i].o[2];
- top[3] := top[3] + st[i].o[3];
- end;
- top[1] := top[1] / n;
- top[2] := top[2] / n;
- top[3] := top[3] / n;
- for y := 1 to n - 1 do
- begin
- for x := y + 1 to n do
- begin
- if st[y].family > st[x].family then
- begin
- temp := st[y];
- st[y] := st[x];
- st[x] := temp;
- end;
- end;
- end;
- println();
- println('Sort:');
- for x := 1 to n do
- begin
- println(st[x].family, ' - ', st[x].o[1], st[x].o[2], st[x].o[3]);
- end;
- println();
- println('Math:', top[1]);
- println('Phys:', top[2]);
- println('Prog:', top[3]);
- println();
- print('Top: ');
- if top[1] > top[2] then
- begin
- if top[1] > top[3] then
- begin
- print('Math');
- end
- else
- print('Prog');
- end
- else
- begin
- if top[2] > top[3] then
- begin
- print('Phys');
- end
- else
- print('Prog');
- end;
- println();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement