3个数比较大小,结果从小到大排列,用pascal语言怎么编?

来源:百度知道 编辑:UC知道 时间:2024/07/07 05:23:02
希望能帮我解决

楼上混分的
冒泡排序法,调用Compositor过程对a,b,c三数排序:

Procedure swap(var a,b:integer);
var temp:integer;
begin
temp:=a;
b:=a;
a:=temp;
end;

Procedure Compositor(var a,b,c:integer);
begin
if a>b then swap(a,b);
if a>c then swap(a,c);
if b>c then swap(b,c);
end;

for i:=1 to 2 do
for j:=i+1 to 3 do
if a[i]>a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
说明部分自己定义

{
$Id: qsort.pp,v 1.2 2002/09/07 15:06:35 peter Exp $
This file is part of the Free Pascal run time library.
Copyright (c) 1993-98 by the Free Pascal Development Team

QuickSort Example

See the file COPYING.FPC, included in this distribution,
for details about the copyright.

This program is distributed in the hope that it will be useful,