2361788963


私信TA

用户名:2361788963

访问量:2287

签 名:

等  级
排  名 8353
经  验 1179
参赛次数 0
文章发表 16
年  龄 0
在职情况 学生
学  校 广州软件学院
专  业

  自我简介:

TA的其他文章

解题思路:这题有点恶心,需要判断输入大于0,不看别人的题解我还没发现

注意事项:

参考代码:

#include<bits/stdc++.h>

using namespace std;

int h, w;

int main() {

ios::sync_with_stdio(false);

cin >> h >> w;

if (h > 0 && w > 0) {

for (int i = 1; i <= 2 * h + 1; i++)

{

for (int j = 1; j <= 2 * w + 1; j++)

{

if (i % 2) {

if (j % 2)cout << "+";

else cout << "-";

}

else

{

if (j % 2)cout << "|";

else cout << " ";

}

}

cout << endl;

}

}

return 0;

}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区