I made a basic snake game in a DOS enviroment using turbo C++ 3.0, and I'm quite a rookie myself. I've been looking for a while for a very simple and perhaps rudimentary way of making text of different colors in a DOS window. I'm not looking for complicated ways of coloring text. Most programs I'm writing are extremely simple and basic, and a complicated code to colour text that's larger than the program itself would just be confusing and ineffective.
My question is, what is the simplest way of coloring text in a DOS console in BOTH language, C and C++?
You can use Turbo C/C++'s-only (that is, non-standard) functions
textcolor()
,textbackground()
andtextattr()
together withcprintf()
,cputs()
andputch()
. See their description in the IDE's help, they're all inconio.h
.