Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- const int chessBoardCells = 8;
- int cellColor = 0; //start with white cell color
- int cellSize = 3;
- std::cout << "Enter cell size: ";
- std::cin >> cellSize;
- std::cout << '\n';
- for (int y = 0; y < cellSize * chessBoardCells; y++)
- {
- if (y % cellSize == 0) { cellColor = !cellColor; };
- for (int x = 0; x < cellSize * chessBoardCells; x++)
- {
- if (x % cellSize == 0) { cellColor = !cellColor; };
- std::cout << (cellColor ? " " : "##");
- }
- std::cout << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement