Chapter 4


  1. Division has more than one operator, / and %.

  2. The addition operator can operate on string as well as numeric operands.

  3. The modulus operator cannot have a floating point operand.

  4. The two division operators, / and %, cannot have zero as a second operand.

  5. total + = 2

  6. The result of 2 + 3 * 4 is 14, not 20, because multiplication has precedence over addition.

  7. The result of the expression 8 / 2 * 4 is 16, not 1, because of associativity. Multiplication and division have equal precedence, so the operations are performed from left to right.

  8. The result of the expression 10 / 4 is 2, not 2.5, because of integer division.

  9. C++, unlike some other programming languages, does not have an exponent operator. Instead, you use the pow function, defined in the cmath standard library, to raise a number to a certain power.

  10. An algorithm is a step-by-step logical procedure for solving a problem.




C++ Demystified(c) A Self-Teaching Guide
C++ Demystified(c) A Self-Teaching Guide
ISBN: 72253703
EAN: N/A
Year: 2006
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net