我有我的课:
class Rectangle : public TwoDim
{
public:
void fun() {};
void printShape();
Rectangle(int x1, int y1, int height1, int width1)
{
x = x1;
y = y1;
height = height1;
width = width1;
}
};
以及打印它的功能:
void Rectangle::printShape()
{
{
cout << "+";
for (int i = 0; i < width - 2; i++)
{
cout << "-";
}
cout << "+\n";
for (int i = 0; i < height - 2; i++)
{
cout << "|";
for (int j = 0; j < +width - 2; j++)
{
cout << " ";
}
cout << "|\n";
}
cout << "+";
for (int i = 0; i < width - 2; i++)
{
cout << "-";
}
cout << "+\n";
}
}
如何更改我的函数以便从该点开始绘制矩形(x, y)
?
非常感谢