Editing PEG:C++ Lesson 4 for Pascal Users
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: | ||
− | + | <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> |