Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  maxim
Language: PASCAL
Code:
type pacticipanti=record begin
     nume:string;
nota:real;
end;
type sir:array [1..255]of participanti;
var n,i,j:integer;
a:sir;
procedure citire(var a:sir,var n:integer);
var i:integer;
begin
write('dati nr de participanti=');readln(n);
for i:=1 to n do begin
write('dati numele concurentului:',i);readln(a[i].nume);
write('dati nota concurentului :',i);readln(a[i].nota);
end;
function max(i,j:integer):integer;
var a,b:integer;
begin
if a[i].nota=a[j].nota then max:=a[i].nume
else begin a:=max(i,(i+j)div 2);
b:=max((i+j)div 2+1,j);
if a>b then max:=a
else max:=b;
end;
begin{p.p}
citire(a,n);
write('max=',' ',max(1,n));
end.
Comments: