The while condition should probably read as:
while (abs(nextValue - currValue) > 0.00000000001 && iter < 100000)
Note that
- There is no semicolon at the end.
- The entire condition must be in parentheses.
- andis replaced by- &&– this is not strictly necessary because- andis valid in C++ as far as I know, but I have never seen- andbeing used in production code so far.
solved Why is my int a pointer? [closed]