Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created March 11, 2013 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imduffy15/5135508 to your computer and use it in GitHub Desktop.
Save imduffy15/5135508 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
string blackSquare = "\033[0;37;40m \033[0m";
string whiteSquare = "\033[0;37;47m \033[0m";
string currentColor = blackSquare;
for(int rows=0;rows<8;rows++) {
for(int cols=0;cols<8;cols++) {
cout << currentColor;
currentColor = currentColor == blackSquare ? whiteSquare : blackSquare;
}
currentColor = currentColor == blackSquare ? whiteSquare : blackSquare;
cout << "\n";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment