Colored table output win
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
HANDLE hConsole = GetStdHandle (STD_OUTPUT_HANDLE); | |
const int aDefaultColor = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; | |
auto printTable = [&](const std::set<Standard_Integer>& theRemSet) { | |
return; // disabled | |
std::cout << setw (3) << " "; | |
for (int j = 0; j < aTableSize; ++j) { | |
std::cout << setw (6) << j; | |
} | |
std::cout << std::endl; | |
for (int i = 0; i < aTableSize; ++i) { | |
bool isIRemoved = theRemSet.find (i) != theRemSet.end(); | |
if (isIRemoved) { SetConsoleTextAttribute (hConsole, FOREGROUND_RED); } else { SetConsoleTextAttribute (hConsole, aDefaultColor); } | |
std::cout << setw (3) << i; | |
for (int j = 0; j < aTableSize; ++j) { | |
bool isRemoved = isIRemoved || theRemSet.find (j) != theRemSet.end(); | |
if (isRemoved) { SetConsoleTextAttribute (hConsole, FOREGROUND_RED); } else { SetConsoleTextAttribute (hConsole, aDefaultColor); } | |
std::cout << setw (6) << setiosflags (ios::fixed) << setprecision (1) << getCoherence (i, j); | |
} | |
std::cout << std::endl; | |
} | |
std::cout << std::endl; | |
SetConsoleTextAttribute (hConsole, aDefaultColor); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment