This is probably a simple question, but I'm stumped. I'm a C/C++ novice.
I'm modifying a Borland C++ Builder program to plot a bitmap of maps of up to 25 sets data. When the data are plotted to the screen, the maps are scaled and shown for a single data set, one at a time, based on the user's choice of map to show. When the data are printed, up to 25 of the maps are scaled and printed together on one piece of paper.
I can get both types of plotting/printing to work fine - individually. I'd like to come up with some sort of construct that will let me do something like:
\nif (hardcopy == true) // we're printing all the maps on 1 page\n{\n for (int k=0; k < 25; k++)\n {\n ((do lots of stuff to construct the maps))\n }\n (do the stuff to send the page to the printer)\n}\nelse // displaying a single map on the screen\n{\n k = SelectedMap;\n ((do the stuff to construct the single map))\n (display the map on the screen)\n}\n
without duplicating so much code in the (( )) block.
How can I construct the code so that if (hardcopy == true) it loops but if (hardcopy == false) then it only uses a single supplied index? I think I want something like a combined if statement with a for loop as a single condition statement, but I don't know of a way to do that.
Thanks very much for any pointers.
Cheers,
Scott.