Color console output with C++ in Windows

前端 未结 4 1156
面向向阳花
面向向阳花 2020-12-14 11:52

Is there a way to output colored text to the console? I am using Visual Studio 2010, and only need the code to work in Windows.

I have been unsuccessful in finding a

4条回答
  •  伪装坚强ぢ
    2020-12-14 12:12

    You can use the system("") command, which is used like that:

    cout<<"lol";
    system("color 1") // the colours are from 1 to 15. 
    cout<<"Coloured text! yay";
    

提交回复
热议问题