1 条题解

  • 0
    @ 2024-12-24 9:49:25

    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;
    }
    
    • 1

    信息

    ID
    971
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者