Change the color of each word in C ++ in skewed programs

    1 answer 1

    In the case of Windows this is done as follows:

     #include <windows.h> // '7' - номер соответствующего цвета, поддерживаемого консолью. ::SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), 7); 

    In the case of *nix you can simply use the ANSI Color Codes , more details can be found here.


    As a non-knee option, I can also suggest the Ncurses library for this purpose .

    • one
      ncurses a little for other purposes. The best option for the Nikses is control sequences. - skegg
    • Addition: ncurses is designed to create a window user interface in the console. - ߊߚߤߘ