为了账号安全,请及时绑定邮箱和手机立即绑定

关于 pascal中标准函数swap(x,y)pascal的解释?

关于 pascal中标准函数swap(x,y)pascal的解释?

鸿蒙传说 2019-02-06 16:07:29
例求两数的最小公倍数function lcm(a,b:integer):integer;beginif a<b then swap(a,b);lcm:=a;while lcm mod b>0 do inc(lcm,a);end;
查看完整描述

2 回答

?
侃侃尔雅

TA贡献1801条经验 获得超15个赞

Exchanges high order byte with the low order byte of an integer or word.

Unit

System

Category

backward compatibility routines

Delphi syntax:

function Swap(X);

Description

In Delphi code, Swap exchanges the high-order bytes with the low-order bytes of the argument. X is an expression of type SmallInt, as a 16-bit value, or Word. This is provided for backward compatibility only.

查看完整回答
反对 回复 2019-03-22
?
慕田峪7331174

TA贡献1828条经验 获得超13个赞

交换a,b两变量的值
swap(a,b)实际上就是
t:=a;//t为临时变量
a:=b;
b:=t;

查看完整回答
反对 回复 2019-03-22
  • 2 回答
  • 0 关注
  • 1091 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信