avr39ripe

cppChessBoardSteroids

Jul 11th, 2021
827
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     const int tableSize{ 8 };
  6.     int cellSize{ 2 };
  7.  
  8.     std::cout << "Enter cell size\n";
  9.     std::cin >> cellSize;
  10.  
  11.     bool cellColor{ true };
  12.     std::cout << '\n';
  13.     for (int y{ 0 }; y < (tableSize * cellSize); ++y)
  14.     {
  15.         for (int x{ 0 }; x < (tableSize * cellSize); ++x)
  16.         {
  17.             cellColor = ((y / cellSize) % 2 != (x / cellSize) % 2);
  18.             std::cout << (cellColor ? "  " : "##");
  19.         }
  20.         std::cout << '\n';
  21.     }
  22. }
RAW Paste Data