简体   繁体   English

如何在 c++ 中表达 Delphi 运算符“<>”?

[英]How do I express the Delphi operator “<>” in c++?

I have had a tough time translating some Delphi code into c++.我很难将一些 Delphi 代码翻译成 c++。 the code is:代码是:

if (GetWindowlong(Stringgrid1.Handle, GWL_STYLE) and WS_VSCROLL) <> 0
then ShowMessage('Vertical scrollbar is visible!');

Ive never really used Delphi before so im not sure what the "<>" operator is.我以前从未真正使用过 Delphi,所以我不确定“<>”运算符是什么。 I looked it up and found out that its called the pointer inequality operator, but im not sure how that translates into c++.我查了一下,发现它叫做指针不等式运算符,但我不确定它是如何转化为 c++ 的。 Thanks a bunch for any help!非常感谢您的帮助!

<> is just not-equals (similar to VB, for some silly reason). <> 只是不等于(出于某种愚蠢的原因,类似于 VB)。 C++ uses.= for pointer inequality like any other inequality. C++ 使用.= 表示指针不等式,就像任何其他不等式一样。

The equivalent operator in C++: Not equal to: != . C++ 中的等效运算符:不等于: !=

So the code should become something like:所以代码应该变成这样:

if ((GetWindowlong(Stringgrid1.Handle, GWL_STYLE) & WS_VSCROLL) != 0) {
    ShowMessage('Vertical scrollbar is visible!');
}

<> means different, and is equivalent to the != operator in C++. <>表示不同,相当于 C++ 中的!=运算符。

The <> operator is spelled != in C-derived languages and simply means inequality <>运算符在 C 派生语言中拼写为!= ,仅表示不等式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM