Print function

I have to make a box of $ that is n wide, n/2 down, and n-2 \b's in the middle rows.
cin << n
if n is 6 it should look like:
$$$$$$
$\b\b\b\b$
$$$$$$

My program is working except it is only printing one \b in the middle rows.

// Program Shell2 promps for the number of dollar signs for
// the top of the box. That number / 2 - 2 lines are
// printed with dollar signs on the sides.

#include <iostream>
#include <string>
using namespace std;

void Print(int numSigns);

int main ()
{
int number;

cout << "Enter the number of dollar signs for the top; "
<< "press return. " << endl;
cout << "Enter end-of-file characer to quit." << endl;
cin >> number;
while (cin)
{
Print(number);

cout << "Enter the number of dollar signs for the top; "
<< "press return. " << endl;
cout << "Enter end-of-file characer to quit." << endl;

cin >> number;
}
return 0;
}

//**************************************

void Print(int numSigns)

int count;
count = 0;

cout << string(numSigns, '$') << endl;
while (count < numSigns / 2 - 2)
{
cout << "$";
cout << (numSigns - 2, " ");
cout << "$" << '\n';
count++;
}
cout << string(numSigns, '$') << endl;

}

Thank you very much to anyone that can help :)
cout << (numSigns - 2, " ");. you meant cout << string(numSigns - 2, ' ');
Thank you very much :)
Topic archived. No new replies allowed.