#include <stdio.h>
void DrawRectangle(int x1, int y1, int x2, int y2)
{
int i,j;
int w = x2-x1;
int h = y2-y1;
if (w <= 0 || h <= 0)
{
printf("宽度和高度都要大于0\n");
}
for (i = 0;i < h;i++)
{
for (j = 0;j <= w;j++)
{
if (i == 0 || i == h - 1 || j == 0 || j == w - 1)
printf("█");
else
printf(" ");
}
printf("\n");
}
}
int main(void)
{
DrawRectangle(10,10,20,30);
return 0;
}
10-12
721
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-27
7812
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-16
521
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-15
3627
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-18
623
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)