How to change the colour of my c++output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to change the colour of my c++output

7th Apr 2017, 1:54 PM
kamran khan
kamran khan - avatar
4 Answers
+ 16
If you mean the styling of console, Right click on top bar of console -> properties -> colors Now you can format your background/text
7th Apr 2017, 2:07 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 11
If you simply want to change console text and background colour for the entire screen, @Luka's suggestion works just fine.
7th Apr 2017, 3:14 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
use this code. #include<iostream.h> #include<graphics.h> #include<stdlib.h> int main() { int gd=0,gm,style; initgraph(&gd,&gm,"C:\\TC\\Bgi"; setcolor(rand()%5); for(style=1;style<=7;style++); { settextstyle(style,HORIZ_DIR,2); outtextxy(getmaxx()\2,getmaxy()\2,"Hello World"); } return; } if you try this in code blocks then remove those ".h" from the header file.
26th May 2017, 10:25 AM
RZK 022
RZK 022 - avatar
- 1
Steps Include the Standard Input and Output library. This common library allows you to change the color that the text output displays. ... Include the Console Input and Output library. ... Use the textcolor function to define what color you want to use for text. ... Add output text and finish the program
11th Sep 2018, 11:11 AM
deepak sharma
deepak sharma - avatar