Mandelbrot screen display

I am having much trouble generating a screen display of the basic Mandelbrot set. What I get is superficially like a full Mandelbrot set but greatly different in detail. I have been planning to use this bit of code in an overview course in Windows programming for seniors (55+) next fall. Can someone look over the code and point out where I have gone wrong? I think the basic logic is right. I have tried declaring all the variables as global and casting all the integers as doubles to be sure I am not using data out of scope or loosing precision by mixing doubles and integers in some of the calculations. Still the same muddled display.

I compiled this code with Visual C++ Express 2010.

This is especially frustrating since I have a Windows program compiled from code I wrote over 20 yrs ago and it does exactly what I need. Of course, I have no idea where the source code is. That was many computers, many houses, and one marriage ago.

I have discovered the problem with my coding. My coding was mixing the values for newFraxctalX from two different iterations. My correction is shown above. This code was designed to be easy to read rather that to be the most efficient for calculations. (I am planning to use this a course for seniors in the fall.)

Hey, It's working pretty nicely. I'm a bit new at Microsoft programming, so this is just a suggestion as far as examples you could show the class;

first start off with this program and show them that yes, it can be re-sized but it's kind of slow when resizing the window (Drawback of drawing everything to screen pixel-by-pixel).

Then show them a second program that builds in full-screen mode, takes a bitmap image of the mandelbrot, then displays the bmp for each new resizing (should run much faster when resizing). - This could be an example of graphics code that runs close to the machine (BMP) vs. code that has to run through the windproc/message loop, and how to use both in tandem. (maybe include a counting variable so you can show them the number of times the program goes through the loop before the whole picture is displayed)

(I also ran across something new for myself, if you were to run the code as you have it above without a "default:" case then the picture is drawn to the screen without a window, maybe don't show that in class, but It was news to me - had to use my compiler's stop button to end the paint. It was kind of neat seeing it displayed without a window though.)