Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Tactics/colour.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (19 sloc)
585 Bytes
This file contains 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
//copied from https://www.daniweb.com/programming/software-development/code/216345/add-a-little-color-to-your-console-text | |
#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 << " I want to be nice today!" << endl; | |
} | |
cin.get(); // wait | |
return 0; | |
} |