随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

procedure TForm1.Button1Click(Sender: TObject);
var
  b: Byte;
  w: Word;
  i: Integer;
  c: Cardinal;
begin
  ShowMessage(IntToStr(SizeOf(b)));  //Byte大小:1
  ShowMessage(IntToStr(High(b)));    //Byte最大值: 255
  ShowMessage(IntToStr(Low(b)));     //Byte最小值: 0

  ShowMessage(IntToStr(SizeOf(w)));  //Word大小:2
  ShowMessage(IntToStr(High(w)));    //Word最大值: 65535
  ShowMessage(IntToStr(Low(w)));     //Word最小值: 0

  ShowMessage(IntToStr(SizeOf(i)));  //Integer大小:4
  ShowMessage(IntToStr(High(i)));    //Integer最大值: 2147483647
  ShowMessage(IntToStr(Low(i)));     //Integer最小值: -2147483648

  ShowMessage(IntToStr(SizeOf(c)));  //Cardinal大小:4
  ShowMessage(IntToStr(High(c)));    //Cardinal最大值: 4294967295
  ShowMessage(IntToStr(Low(c)));     //Cardinal最小值: 0
end;
posted on 2007-11-30 17:32  万一  阅读(...)  评论(...编辑  收藏