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