// the number of blanks surrounding the greeting
constint pad = 1;
// the number of rows and columns to write
constint rows = pad * 2 + 3;
const string::size_type cols = greeting.size() + pad*2+2;
We begin by observing that all the output lines are the same length. If we think of the output
as a rectangular array, then that length is the number of columns in the array. We can compute that number by adding twice the padding to the length of the greeting, and then adding two for the asterisks at the ends:
I don't understand why she double The amount of blanks then add'd 2. the out put is only 1 column then the *. and removing the numbers still gives me a * and a blank column on the left side.
Is what I thought but changing that number still leaves the other ones on the left side. and how is knowing to divide them equally? I guess I just need a further explanation of the math behind it.
The spacing doesn't work on forums but there's 1 space and then one astreik between the start and end of the greeting. so 2 on one side 2 on the other for a total of 4.
For rows you multiply by 2 since you will need the padding on the top and the bottom then add 3 so that way there is an empty line between the padding and the message on the top and bottom. For columns you want the size of the message then add the padding * 2 again for left/right then add 2 for the space on the left and the right.