|
| |
Expressions in C++ are similar to math
but...
- in math, you can omit the
multiplication operator
- xy means x times y
- the multiplication operator is
represented by "*"
- x*y means x times y
- in math you can use a bar to
indicate divisions
|
in math
|
in C++
|
|
1
|
|
- --------
|
1/(x+1)
|
- x + 1
|
|
In math, we don't usually
differentiate integer and float:
- 1/2 is zero ... 1./2. is 0.5
- In C++ equal sign means: make this
variable equal to ...
- x=x+1; x+1=x does not exist!
- In C++ there are no [ ] or { } for
expressions, only () !
|