Monday, 25 December 2017

HOW TO CHANGE COLOR OF TEXT IN C++

In this blog let us see how to change color of text in C++

C++ code to change color of the text-



Sample output for the above program-


Color codes for different color-

  • BLACK 0
  • BLUE 1
  • GREEN 2
  • CYAN 3
  • RED 4
  • MAGENTA 5
  • BROWN 6
  • LIGHTGREY 7
  • DARKGREY 8
  • LIGHTBLUE 9
  • LIGHTGREEN 10
  • LIGHTCYAN 11
  • LIGHTRED 12
  • LIGHTMAGENTA 13
  • YELLOW 14
  • WHITE 15
  • BLINK 128

Note-

With reference to my c++ code above, anything written below line number 8 will be printed in Light magenta.
In order to change color once again in the program, write "SetConsoleTextAttribute(handle,(any number from above of your choice));".
This will change the color of all the text below it.


For any c++ code ask me in the comments below.
I will code and give you the answer, thus making your homework easy.




No comments:

Post a Comment