#include using namespace std;

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

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 if (solid == 1) {
            cout << symbol;
        } else {
            cout << " ";
        }
    }
    cout << endl;
}

return 0;

}

描述根据参数画出矩形。输入四个参数:前两个参数为整数依次代表矩形的高和宽高不少于3行不多于10行宽不少于5列不多于10列;第三个参数是一个字符表示用来画图的矩形符号;第四个参数为1或00代表空心1代表实心。输入描述输入一行包括四个参数:前两个参数为整数依次代表矩形的高和宽高不少于3行不多于10行宽不少于5列不多于10列;第三个参数是一个字符表示用来画图的矩形符号;第四个参数为1或00代表空心1代表

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

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