Skip to content

Instantly share code, notes, and snippets.

Last active Feb 10, 2017
What would you like to do?
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;
return 7;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment