蜡烛为什么会燃烧:Pascal简单的编程

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 17:22:26
在键盘输入四个正整数,将他们按照由小到大的顺序输出.

求教各位高手..

PROGRAM 程序名(input,output);
Var a,b,c,d,t: Real;
Begin
Write('Input a, b,c=');
Readln(a,b,c,d);
if a>b then
begin {复合语句}
t:=a; a:=b; b:=t {交换a,b}
end;
if a>c then
begin {复合语句}
t:=a; a:=c; c:=t {交换a,c}
end;
if a>d then
begin {复合语句}
t:=a; a:=d; d:=t {交换a,d}
end;
if b>c then
begin {复合语句}
t:=b; b:=c; c:=t {交换b,c}
end;
if b>d then
begin {复合语句}
t:=b; b:=d; d:=t {交换b,d}
end;
if c>d then
begin {复合语句}
t:=c; c:=d; d:=t {交换d,c}
end;
Writeln('a,b,c,d:',a:6, b:6, c:6, d:6);
Readln
End.