I am writing a program that creates a rectangle with the user's dimensions. But, for some reason it always displays incorrectly.
Example
Height: 5
Width: 5
Character: *
MZH - in line 27, I set w=10 to reset the width because I would be using it again in the future. DatDankMeme - I'm pretty new to C++ so I couldn't really figure out any other way to do it. You helped a ton. Thomas1965 - I didn't know you could do that with strings. Thanks.
ja r ed: Setting w=10 would only work if the length of the row was 10. Instead, every row after the first will have a length of 10, regardless of user input. That's why the output in your initial post looks the way it does. To fix your while loop in your initial program, you need a second variable to save the original width from the function parameter.