As you can see in the following code, I declared my height variable before the do-while loop (on Line 5). Would it have been better -- or even possible -- to perform this step within the loop?
In other words, could I replace Line 9 with int height = get_int();
and delete Line 5?
BTW, this code hasn't been tested, so feel free to point out any errors! :-)
(I'm also assuming that posting this code snippet is considered "reasonable" as per policy.)