Created
June 28, 2012 06:31
-
-
Save volkansalma/3009508 to your computer and use it in GitHub Desktop.
Colored console (windows)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> // WinApi header | |
using namespace std; // std::cout, std::cin | |
int main() | |
{ | |
HANDLE hConsole; | |
int k; | |
hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | |
// you can loop k higher to see more color choices | |
for(k = 1; k < 255; k++) | |
{ | |
// pick the colorattribute k you want | |
SetConsoleTextAttribute(hConsole, k); | |
cout << k << " Volkan SALMA!" << endl; | |
} | |
cin.get(); // wait | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment