After it addition and subtraction are performed from

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s, if given are evaluated from right. Then multiplication and division is performed from right. After it, addition and subtraction are performed from 11 left to left to left to 11 Assignment Operator The operator which is used to assign value of an expression to variable is called Assignment operator. It has the general form as: Variable = expression; Where expression may be constant, another variable to which a value has previously been assigned or a formula to be evaluated. Examples are a=5; c=a c = a+b; Assignment statement may be written in compound form as int a=b=c=50; 12 Arithmetic Assignment Operators The arithmetic assignment operator is the combination of arithmetic and assignment symbols they are unique to C++. These include +=, -= , *=, /= and %= For example, consider the following statement Sum = Sum + num; We could write this statement as Sum + = num; The effect is exactly the same but the expression is more compact. Some more examples are: Sum -= num is equivalent to Prod *= num is equivalent to Sum = Sum – num Prod = Prod * num 13 13 Relationa...
View Full Document

Ask a homework question - tutors are online