I've been slowly getting my way through a teach yourself C++ book and so far its been great. I like the structure and explanations and feel I am learning something! But I've hit a hurdle in a place I least expected it and could do with an expansion of the explanation.
I'll just copy the examples from the book...
Assuming
count
starts as 5 in all examples,
So this is "total = count + 1 + 6 = 12". I get this.
... this is "total = count - 1 + 6 = 10". I get this too.
But it's the postfix operators that have me stumped.
(later re-written as 6 + count++)
Apparently this is 11. I just don't get it! Not unless it reads as "total = 6 + count = 11", then
count
is changed to 6 without affecting
total
.
Same for
Apparently this is also 11. Same thing, I can only see it if it reads as "total = 6 + count = 11", then
count
is changed to 4 without affecting
total
.
Any help would be great. I don't really want to skip passed this chapter section.
Thank you