C++ Primer For Java Programmers

Expressions and Operators

Table of Contents
Mathematical expressions are constructed using the mathematical operators

avg = (grade1 + grade2 + grade3) / 3.0;

which are the same as those in Java

  +  -  *  /  %  ( )

If both operands are integers, then integer arithmetic is performed and the result will be an integer value. If one or both of the operands are real values, then real arithmetic is performed and the result is a real value. (For operator precedence, see the order of precedence table.)

Table of Contents

Print - Changes - Search
Last modified: April 27, 2007, at 05:08 PM.