Picture

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 <stdio.h> 
 2  
 3 int main(){
 4     int width;
 5     int height;
 6     int i;
 7     int j;
 8     
 9     while((scanf("%d%d",&width,&height))!=EOF){
10         printf("+");
11         
12         for(i=0;i<width;i++)
13             printf("-");
14             
15         printf("+\n");
16         
17         for(i=0;i<height;i++){
18             printf("|");
19             for(j=0;j<width;j++){
20                 printf(" ");
21             }
22             printf("|\n");
23         }
24         
25         printf("+");
26         
27         for(i=0;i<width;i++)
28             printf("-");
29             
30         printf("+\n\n");
31     }
32         
33     return 0;
34 }

 

 

posted @ 2014-10-28 23:59  zqxLonely  阅读(262)  评论(0编辑  收藏  举报