定义一个求三个数的最大数的函数和过程

来源:百度知道 编辑:UC知道 时间:2024/05/21 22:58:16
PASCAL编程

函数:function compare(a,b,c:integer):integer;
begin
if a>b then if b>c then compare:=a
else if c>a then compare:=c
else compare:=a
else if a>c then compare:=b
else if c>b then compare:=c
else compare:=b;
end;

过程:procedure compare(a,b,c:integer;var max:integer;);
begin
if a>b then if b>c then max:=a
else if c>a then max:=c
else max:=a
else if a>c then max:=b
else if c>b then max:=c
else max:=b;
end;