Editing PEG:C++ Lesson 4 for Pascal Users

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{C++ Lesson for Pascal Users|4}}
+
<center>[[PEG:C%2B%2B_Lesson_3_for_Pascal_Users|← Previous Lesson]] | [[PEG:C%2B%2B_Lesson_5_for_Pascal_Users|Next Lesson →]]<br><br></center>
 
C++ has a few operators that Pascal doesn't, but you don't need to know about them right now.<br><br>
 
C++ has a few operators that Pascal doesn't, but you don't need to know about them right now.<br><br>
 
Arithmetic operators (<code>+</code>, <code>-</code>, <code>*</code>, and <code>/</code>) are the same in C++ as in Pascal, with one exception. In Pascal, / always yields a real, even if the operands were both integers and the quotient is an integer. In C++, dividing two integers always gives an integer (but if at least one operand is real then the result will be real too.) C++ also has the unary plus and minus (although unary plus is pretty useless...) We are able to do arithmetic with chars too, as they are stored as <code>shortint</code>s.<br><br>
 
Arithmetic operators (<code>+</code>, <code>-</code>, <code>*</code>, and <code>/</code>) are the same in C++ as in Pascal, with one exception. In Pascal, / always yields a real, even if the operands were both integers and the quotient is an integer. In C++, dividing two integers always gives an integer (but if at least one operand is real then the result will be real too.) C++ also has the unary plus and minus (although unary plus is pretty useless...) We are able to do arithmetic with chars too, as they are stored as <code>shortint</code>s.<br><br>

Please note that all contributions to PEGWiki are considered to be released under the Attribution 3.0 Unported (see PEGWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)

Templates used on this page: