需要输出:
其中,每个偶数行最后一个“*”的后面还有一个空格,以下是代码,请问如何修改?
#include<iostream>
using namespace std;
int main()
{
int h, l;
for (h = 1; h <= 8; h++)
{
for (l = 1; l <= 16; l++)
{
if ((h + l) % 2 != 0)
{
cout << ' ';
}
else
{
cout << "*";
}
}
cout << endl;
}
}
星号棋盘啥效果啊?贴图看看