• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
August 22, 2022 |9.7K Views

C++ Program to print colored text

  Share   Like
Description
Discussion

In this video, we'll show you how to print coloured text using the C++ library.

In computer programming, printing text is a common task. The standard way to do this is to use the system function printf(). This function takes several arguments, such as the name of the file where the output should go, the number of characters printed, and the colour of each character.

In C++ programming, by default the background of the output screen is black and the text colour is in white colour. We can colour both the background and text colour in the output screen in the following ways.

We need to add the following Header Files for changing the colour of a text.

#include <windows.h>  
#include <stdlib.h>

Syntax: system("Color XY")

Here, we have used the above-mentioned command to change the background colour and text.

How to print Colored text in C++
https://www.geeksforgeeks.org/how-to-print-colored-text-in-c/