0
how to change background colour after runing a c++ program
c++
2 Réponses
0
You might have to look that one up on the internet. The console it uses in our case is just command prompt. There might be a line of code that you can write in your program that will tell the command prompt console to use a different background color/text color. If you open command prompt normally and type "help colors" or just "colors" it will give you a list of colors and their corresponding codes. You can play around with background and text colors using these color codes. Type in "color" followed by two color codes the first one being the color for the background and the second being the one for the text.
You can also try fiddling around with batch programs (a program running off of cmd commands). Open cmd and just type help and it will tell you a bunch of different commands you can use and play around with. There are a lot of other commands for cmd that will not be in the help list, all of which can be looked up online.
In order to make a batch program you can just open notepad and write your batch program and save it as a .bat file.
I think its useful to know somw batch programming because it very similar to any other language but much less complicated. And you actually can do some interesting things with it. Like make number games. idk.
0
That is OS-Specific.
in Windows you need to use a function called setcolor (which you can find in the internet) .
in *nix you need to use escape codes (which you can also find in the internet).