0
How to display chessboard using while
i have try many time, but it still not correct U_U anyone help please. They want us to display the chessboard with the given cell from user. Ex: user input 3 cell. display: ***___***___***___ ***___***___***___ ***___***___***___ ___***___***___*** ___***___***___*** ___***___***___*** The line is always 6 and the column is always 4 just that the amout of * or _ to display is input by user
14 ответов
+ 1
they want the user to imput the cell
Ex:
cin>>4
the cell change to
****____
cin>>6
the cell change to
******______
By what i mean is that the amout of * or _ is imput by user, but for only 1 time. @ Vishal
+ 1
#include <iostream>
//to make string output
#include <string>
using namespace std;
int main()
{
string black;
string white;
int cells;
int boardSize = 0; //starting number
cout << "How many cells?: ";
cin >> cells;
//add to black and white the number of cells
for (int x = 0; x < cells; ++x) {
black += "*";
white += "_";
}
//6 for 6 lines
while (boardSize < 6) {
//3 for black and white 3 times
for (int i = 0; i < 3; ++i) {
cout << black << white;
}
cout << endl;
++boardSize;
}
}
+ 1
Convert that for to while. This is something u must do
+ 1
If you really mean the word in ur name "Otaku". You must really learn coding to every last bit!
+ 1
xD i dun know if i should say thank you or kill you instead😂 Thank u hahahha i will try
0
i use in c++ for my homework
0
cool, i am planning on using c# in a game engine, its my 1st attempt.
0
x'D i'm just a beginner, my classmate are all boys and they catch up easily and they try hard, while i study 3 majors and dun do any excersices, just that i start to try hard from now on, ;_; but i dun have much time since i am always study and tired af
0
@Otaku You want to display a chessboard on the screen with *** as black and ___ as white?
If yes, what do u mean be user inputs 3?
0
Understood. And its 6x6 chessboard instead of original 8x8 chessboard. Otaku, how about u start writing the program? And when ur stuck I can help
0
😂 ok, but i didn't display anythings that is why i wonder wth is wrong with it i will write it to u, but i have 4 class this afternoon, so i can't write it now ad thank q so much
0
Thank you so much!! but i haven't write the code yet. I will test it tonight!!! * bow* really thank you.
0
;_; but he said to only use while or do not for
- 1
how is c++? i have never tried it before. you using an game engine or Microsoft visual?