delphi not 与整数


本文整理自网络,侵删。

 not 与整数
//Byte
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Byte;
begin
x := MAXBYTE; //MAXBYTE是常数255
y := not x; //y 的值是 0

x := 5;
y := not x; //y 的值是 250
ShowMessage(IntToStr(y));
end;

//Word
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Word;
begin
x := MAXWORD; //MAXBYTE是常数65535
y := not x; //y 的值是 0

x := 5;
y := not x; //y 的值是 65530
ShowMessage(IntToStr(y));
end;

//Cardinal
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Cardinal;
begin
x := 4294967295; //Cardinal 类型的最大值
y := not x; //y 的值是 0

x := 5;
y := not x; //y 的值是 4294967290
end;

//Integer
procedure TForm1.Button1Click(Sender: TObject);
var
x,y: Integer;
begin
x := MaxInt; //MAXInt是常数2147483647
y := not x; //y 的值是 -2147483648, 也就是Integer的最小值

x := 5;
y := not x; //y 的值是 -6

y := not x + 1; //y 的值是 -5
end;

相关阅读 >>

Delphi xe android/ios 实现图片放大缩小的两种方法

Delphi里面控制edit只能输入数字

Delphi spcomm的一些用法注意

Delphi 2009 之 tballoonhint

Delphi 随机函数单元urandomutils

Delphi 得到ip地址最后一个点后面的值

Delphi urldownloadtofile 实现文件下载

Delphi xe中将正则表达式tregex的使用

Delphi webbrowser设置自己定义user-agent

Delphi如何简单取得后缀名

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...