#include using namespace std;

int main() { int height, width, solid; char symbol; cin >> height >> width >> symbol >> solid;

if (solid == 1) {
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            cout << symbol;
        }
        cout << endl;
    }
} else {
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            if (i == 0 || i == height - 1 || j == 0 || j == width - 1) {
                cout << symbol;
            } else {
                cout << ' ';
            }
        }
        cout << endl;
    }
}

return 0;

}

C++ 绘制矩形:空心或实心图形

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

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