问题描述
使用while语句创建棋盘程序,你只能使用两个cout语句..(使用C ++)
一个cout是cout<< whiteRow<< endl;
其他cout是cout<< blackRow<< endl;
whiteRow = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK;
blackRow = BLACK + WHITE +黑色+白色+黑色+白色+黑色+白色;
该程序的尺寸为8个5行,看起来相似?
远这就是我所拥有的:
#include< iostream>
#include< string>
using namespace std;
const string BLACK =" ********";
const string WHITE =" ;
int main()
{
whiteRow = WHITE + BLACK + WHITE + BLACK +白色+黑色+白色+黑色;
blackRow =黑色+白色+黑色+白色+黑色+白色+黑色+白色;
while(count< = 5)
cout<< whiteRow<< endl;
count ++
innercount = 0
while(innercount< 5)
cout< < blackRow<< endl;
innercount ++
~~~可以真的使用帮助谢谢你
请帮助..
Create a chessboard program by using while statements and you can only use TWO cout statments.. (using C++)
One cout is cout<< whiteRow << endl;
THe other cout is cout <<blackRow << endl;
whiteRow = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK;
blackRow = BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE;
The program has the dimensions of 8 blocks of 5 lines that look alike ??
SO far this is what I have:
#include <iostream>
#include <string>
using namespace std;
const string BLACK = "********";
const string WHITE = " ";
int main ()
{
whiteRow = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK;
blackRow = BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE;
while (count <= 5)
cout << whiteRow << endl;
count ++
innercount = 0
while (innercount <5)
cout << blackRow << endl;
innercount++
~~~ Could really use the help THANKYOU
Please Help..
推荐答案
这篇关于使用While语句的Chess Board Program的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!