开发者

How do I express the Delphi operator "<>" in c++?

开发者 https://www.devze.com 2023-03-03 03:32 出处:网络
I have had a tough time translating some Delphi code into c++. the 开发者_Go百科code is : if (GetWindowlong(Stringgrid1.Handle, GWL_STYLE) and WS_VSCROLL) <> 0

I have had a tough time translating some Delphi code into c++. the 开发者_Go百科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. I looked it up and found out that its called the pointer inequality operator, but im not sure how that translates into c++. Thanks a bunch for any help!


<> is just not-equals (similar to VB, for some silly reason). C++ uses != for pointer inequality like any other inequality.


The equivalent operator in C++: Not equal to: !=.

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++.


The <> operator is spelled != in C-derived languages and simply means inequality

0

精彩评论

暂无评论...
验证码 换一张
取 消