|so don't increment the iWidthCount?|
Only if you want to end up in an infinite loop.
I am confused[.]
Well, if you don't mind the mangled output, you could see what is happening by changing the test on your second while to this:
while ((cout << iWidthCount) && iWidthCount <= iWidth)(As you might have guessed, it shows you the value of iWidthCount whenever the inner loop is tested.)
Alternatively, you could just use VS' debugger to go though your code step-by-step, and watch your variables.