Windows CMD colors in c++

  ansi, c++, colors

I tried using the ansi codes to make the words in the cmd have color. I worked when I used the batch method

system("echo [91m");

But when I do it normally

std::cout << "[91m";

It just displays the asni code as text.
Does anyone know why this is?
How do I fix this?

Source: Windows Questions C++