IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesC++/CLI  Print This     

Comparison Operators (C++/CLI and Delphi Prism Cross Reference Guide)

By Mike Prestwood

C++/CLI versus Delphi Prism: A side by side comparison between C++/CLI and Delphi Prism.

 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

Comparison Operators

[Other Languages] 

General Info: Round Floating Point Numbers

When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.

Languages Focus

A comparison operator compares two values either literals as in "Hello" and 3 or variables as in X and Counter. Most languages use the same operators for comparing both numbers and strings. Perl, for example, uses separate sets of comparison operators for numbers and strings.

C++/CLI:   ==, !=

Same as standard C++. Common comparison operators:

== equal
!= not equal
< less than
> greater than
<= less than or equal
>= greater than or equal
Syntax Example:
//Does C++/CLI evaluate the math correctly? No!
if (0.1 + 0.1 + 0.1 == 0.3)
MessageBox::Show("correct");
else
MessageBox::Show("not correct");
Delphi Prism:   =, <>

Same as Delphi. Common comparison operators:

= equal
<> not equal
< less than
> greater than
<= less than or equal
>= greater than or equal
Syntax Example:
//Does Prism evaluate the math correctly? No!
//This is different than later versions of 
//Delphi that muse MaxSingle in math.pas.
If .1 + .1 + .1 = .3 Then
MessageBox.Show("correct")
Else
MessageBox.Show("not correct");












Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]