HDU_2052——画矩形
Problem Description
Give you the width and height of the rectangle,darw it.
Input
Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.
Output
For each case,you should draw a rectangle with the width and height giving in the input. after each case, you should a blank line.
Sample Input
3 2
Sample Output
+---+ | | | | +---+
1 #include <cstdio> 2 int main() 3 { 4 int n,m; 5 while(~scanf("%d%d",&n,&m)) 6 { 7 printf("+"); 8 for(int i=0;i<n;i++) 9 { 10 printf("-"); 11 } 12 printf("+\n"); 13 for(int i=0;i<m;i++) 14 { 15 printf("|"); 16 for(int j=0;j<n;j++) 17 { 18 printf(" "); 19 } 20 printf("|\n"); 21 } 22 printf("+"); 23 for(int i=0;i<n;i++) 24 { 25 printf("-"); 26 } 27 printf("+"); 28 printf("\n\n"); 29 } 30 return 0; 31 }
——现在的努力是为了小时候吹过的牛B!!