B - Picture

B - Picture,第1张

B - Picture
     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

    +---+
    |   |
    |   |
    +---+

 

#include
int main()
{
	int wid,hei,i,j;
	while(scanf("%d %d",&wid,&hei)!=EOF)
	{
		for(i=0;i<=hei+1;i++)
		{
			for(j=0;j<=wid+1;j++)
			{
				
				if(i>=1&&i<=hei)
				{
					if(j==0||j==wid+1)
					{
						printf("|");
					}
					else
					printf(" ");
				}
				
				if(i==0||i==hei+1)
				{
					if(j==0||j==wid+1)
					{
						printf("+");
					}
					else
					{
						printf("-");
					}
				}
			
			}
			printf("n");
		}
		
		printf("n");
	}
	return 0;
}

好久没有做英文题了,这道题也是相对比较简单,按照题目意思输出即可

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5651448.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存