H
hsgrass
Unregistered / Unconfirmed
GUEST, unregistred user!
function _4Multiple(const a: integer): integer;
begin
result := ((a + 3) shr 2) shl 2
// 加3然后整除2,再乘2就是4的倍数,为什么?
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a: integer;
i: integer;
begin
for i := 0 to 10 do
begin
memo1.lines.add(inttostr(_4multiple(i)))
end;
end;
begin
result := ((a + 3) shr 2) shl 2
// 加3然后整除2,再乘2就是4的倍数,为什么?
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a: integer;
i: integer;
begin
for i := 0 to 10 do
begin
memo1.lines.add(inttostr(_4multiple(i)))
end;
end;