Unit 4 - The Expression

Posted on Friday, May 7, 2010 by B[H] | 0 comments
Labels:

Expression in C++ are formed by properly combining operators, variables and constants. We have already seen some examples of simple arithmetic and logical expression. As algebra, C++ expression can be complex. Parentheses can be used to force the order of evaluation. An expression may also contain spaces for readability.
Examples of expressions.

Gross_pay – deductions
(basic_pay + hours * rate) – (socso + premium + loan)
(b * b – 4 * a * c) > 0
(gender = = ‘m’) && (age > 20)
(gender = = ‘m’ || gender = = ‘f’ ) && age >= 21

No comments:

Post a Comment