2033 - P342 12

通过次数

0

提交次数

0

时间限制 : 1 秒 内存限制 : 128 MB

P342 12

题目输入

n

题目输出

stars

输入/输出样例

输入格式

4

输出格式

****
*  *
*  *
****

C++解答

#include<iostream>

using namespace std;

void Rectangle(int);

int main()
{
	int a;
	cin >> a;
	Rectangle(a);

	return 0;
}

void Rectangle(int a)
{
	for(int col=1; col<=a; col++)
	{
		cout << '*';
	}
	cout << endl;
	for(int row=2; row<=a-1; row++)
	{
		cout << '*';
		for(int col=2; col<=a-1; col++)
		{
			cout << ' ';
		}
		cout << '*' << endl;
	}
	for(int col=1; col<=a; col++)
	{
		cout<< '*';
	}
	cout << endl;
}