Skip to content

Instantly share code, notes, and snippets.

@Alynva
Last active February 10, 2017 18:44
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 Alynva/072cdd16f924de0d14fb2d5bde27a2d7 to your computer and use it in GitHub Desktop.
Save Alynva/072cdd16f924de0d14fb2d5bde27a2d7 to your computer and use it in GitHub Desktop.
Changing de output color on Windows terminal
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// you can loop k higher to see more color choices
for(int k = 0; k <= 255; k++) {
// pick the colorattribute k you want
SetConsoleTextAttribute(hConsole, k);
cout << k << " Abobrinha " << k;
}
system("PAUSE");
return 7;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment