#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;

    // 输出上半部分
    for (int i = 0; i < n / 2; i++) {
        for (int j = 0; j < n; j++) {
            cout << '*';
        }
        cout << endl;
    }
    
    // 输出中间一行
    for (int j = 0; j < n; j++) {
        cout << '#';
    }
    cout << endl;

    // 输出下半部分
    for (int i = n / 2 + 1; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << '*';
        }
        cout << endl;
    }

    return 0;
}
C++ 生成奇数行奇数列的星号图案

原文地址: https://www.cveoy.top/t/topic/p3In 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录