12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20 Day 1<br />

never get <strong>in</strong>to. There are a lot of operators <strong>in</strong> <strong>C++</strong>. Rather than present them all here, I will<br />

list only those most commonly used. Table 1.2 conta<strong>in</strong>s a list of those operators.<br />

Table 1.2. Commonly used <strong>C++</strong> operators.<br />

Operator Description Example<br />

Mathematical Operators<br />

+ Addition x = y + z;<br />

– Subtraction x = y - z;<br />

∗ Multiplication x = y * z;<br />

/ Division x = y / z;<br />

Assignment Operators<br />

= Assignment x = 10;<br />

+= Assign and sum x += 10; (same as x = x + 10;)<br />

-= Assign and subtract x -= 10;<br />

*= Assign and multiply x *= 10;<br />

\= Assign and divide x \= 10;<br />

&= Assign bitwise AND x &= 0x02;<br />

|= Assign bitwise OR x |= 0x02;<br />

Logical Operators<br />

&& Logical AND if (x && 0xFF) {...}<br />

|| Logical OR if (x || 0xFF) {...}<br />

Equality Operators<br />

== Equal to if (x == 10) {...}<br />

!= Not equal to if (x != 10) {...}<br />

< Less than if (x < 10) {...}<br />

> Greater than if (x > 10) {...}<br />

= 10) {...}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!