Please read:
http://www.cplusplus.com/doc/tutorial/control/#for
I think you might be thinking about it a little bit backwards. First thing that happens is that val is assigned the value of -10.0, then the condition val < 100.0 is checked (which in this case is true since val = -10.0). Since the condition is true, the loop continues execution. At this point, from what I understand from your post, you think that the next thing that executes is
val = -val * 2
? Rather, after the condition is checked, the block of code for the loop executes (in this case, it's just line 7) thus the program prints out -10. After the block of code executes, the
val = -val * 2
part is executed and val now equals 20. The condition is then checked and the loop either finishes (if the condition is false) or continues with another iteration (if the condition is true) which, in your code, displays the new value of val: 20. It keeps doing this until val >= 100.
Essentially, the condition is checked
before the iteration of the loop, and the increment happens
after the iteration of the loop. (The initialization of val happens only once when the for loop is initially reached.)
Side note: Usually it is considered bad practice to use floating point numbers as a counter in a loop. In this case I don't see it as being an issue*, but be aware of it (it's also a good habit to get into).
Hope that helps.
* if my understanding of the floating point format is correct, it can hold the non fractional component of the number reliably. I may be wrong though, someone will hopefully chime in.