void print_frame(string, int);
// function to print a given message inside an asterisk frame with the given padding
/**/
void print_frame(string msg, int pad) {
// define the number of rows and cols based on the padding value given
/**/
const string::size_type rows = pad * 2 + 3;
const string::size_type cols = msg.size() + pad * 2 + 2;
// calculate how much white space is needed and define a buffer
/**/
const string::size_type s_size = msg.size() + pad * 2;
const string s_buf(s_size, " ");
for (int r = 0; r != rows; ++r) {
string::size_type c = 0;
while (c != cols) {
// is it time to print the message?
/**/
if (r == pad + 1 && c == pad + 1) {
cout << msg;
c += msg.size();
}
// check to see if we are on the border
/**/
if (r == 0 || r == rows - 1 || c == 0 || c == cols -1) {
cout << "*";
++c;
} else {
cout << s_buf;
c += s_size;
}
}
cout << endl;
}
}
Can someone please help me figure out why I'm getting an error C2664 for initializing the s_buf var it would be much appreciated.