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


求两数的最小公倍数

function lcm(a,b:integer):integer;
begin
if a<b then swap(a,b);
lcm:=a;
while lcm mod b>0 do inc(lcm,a);
end;

鸿蒙传说
浏览 1096回答 2
2回答

侃侃尔雅

Exchanges high order byte with the low order byte of an integer or word.UnitSystemCategorybackward compatibility routinesDelphi syntax:function Swap(X);DescriptionIn 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.

慕田峪7331174

交换a,b两变量的值swap(a,b)实际上就是t:=a;//t为临时变量a:=b;b:=t;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Maya