Description
给你一个矩形的宽度和高度,要求按sample output样例输出此矩形。
Input
输入包含多组数据,每一组包含两个数N和M( 0 < N ,M , < 75 )分别代表矩形的宽和高。输入以EOF结束。
Output
对每一组N和M,输出相应的矩形。每一组输出结束后输出一个空行。
Sample Input
3 2
Sample Output
+---+
| |
| |
+---+
Source
Hdu 翻译
#include <stdio.h>
int main()
{
int n, m;
int i,j;
while ( ~scanf("%d%d", &n, &m))
{
printf("+");
i = n;
while (i--)
printf("-");
printf("+\n");
j = m;
while (m--)
{
printf("|");
i = n;
while (i--)
printf(" ");
printf("|\n");
}
printf("+");
i = n;
while (i--)
printf("-");
printf("+\n");
printf("\n");
}
return 0;
}