Change the color of the text in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Change the color of the text in c++

I know i can change color but how i can change without change others?? Like this: hi(in red) hi(in blue)

25th May 2020, 5:20 PM
Lucas
6 Answers
+ 1
Use graphics headerfile #include<graphics.h> And set graphics path And for text print Use outtextxy(pass two parameter nd seprate with comma, " text"); For color use Setcolor (color name );
27th May 2020, 5:09 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Yes u can but not in sololearn compiler Try to use code blocks on pc Or cxxdroid apk And then use graphic lib like this
25th May 2020, 5:23 PM
Abhay
Abhay - avatar
+ 2
#include <conio.h> void main() { clrscr(); textcolor(RED); cprintf ("Welcome to Tutorial of Graphics in C/C++\n"); textcolor(LIGHTBLUE); cprintf("Hello\n"); getch(); }
25th May 2020, 5:26 PM
Abhay
Abhay - avatar
+ 2
Abhay the code doesnt works in windows
25th May 2020, 5:36 PM
Lucas
+ 1
Abhay ok I am on it sololearn IDE is not as good as Codeblocks and the rest.
25th May 2020, 5:26 PM
Isaac Duah [Active!]
Isaac Duah [Active!] - avatar