Answers for "cmd color text c++"

C++
0

cmd color text c++

#include <iostream>
#include <windows.h> 
int main()
{
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    for(int k = 1; k < 255; k++) //higher k = more colour
    {
        SetConsoleTextAttribute(hConsole, k);
        std::cout << k << std::endl;
    }
}
Posted by: Guest on September-17-2021

Browse Popular Code Answers by Language