有序类型的大小及最大、最小值

有序类型的大小及最大、最小值

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  万一  阅读(3382)  评论(2)  编辑  收藏
上一篇:变体数组


下一篇:文件路径相关的字符串操作