解题思路:这题有点恶心,需要判断输入大于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 人评分
汽水瓶 (C语言代码)浏览:600 |
C二级辅导-公约公倍 (C语言代码)浏览:1508 |
这可能是一个假的冒泡法浏览:985 |
【出圈】 (C语言代码)浏览:795 |
母牛的故事 (C语言代码)浏览:930 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:1000 |
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:906 |
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:582 |
K-进制数 (C语言描述,蓝桥杯)浏览:925 |
大家好,我是验题君浏览:577 |