Adding Colors to you C++ Program Output

There are several methods that can be used to add colors to your C++ program output but the simplest way is by using the system function. The system function allows you to pass commands to the operating system for execution. The syntax of using system varies in different programming languages. In C++, system function takes the following syntax:

system(“command”);
example:

system(“logoff”);
To add a color to your program output, use the color command which has the following syntax:

color bf
Were b is the background and f is the foreground.
Available colors for background and foreground are as follows:

0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White
So if you want to have a black background with light green text, use:

system(“color oa”);

system function is typed inside your main function (or inside other functions) just after the opening curly brace and before the closing curly brace.

example:
#include<iostream>
using namespace std;
int main()
{
system(“Color 0a”);
cout<<”I am blue”;
cin.get();
}

The codes above produce a red text in black background. There are several things that you can do with the system function, and it’s up to you to discover. Good luck!

Viewing the Control Toolbox in Microsoft Visual C++ 6.0 MFC

Unlike other application and development tools, Visual C++ does not permit viewing some of its Integrated Development Environment (IDE) components such as dialog box or control toolbox using the View menu. Unintentionally closing an IDE component could result to total disarray. To show one of its important components, the Control toolbox, use any of the following methods:

Method 1:

1. Right-click an empty pane in the Microsoft Visual C++ toolbar. A pop-up menu containing several options will be displayed>Select Controls option.

Note: The Controls option only appears on the pop-up menu if your dialog-based application is shown on the screen. If you dialog-box is hidden, click the resource tab on the right pane of you Visual C++ IDE> Expand the Dialog tree control item>Double-click IDD_Nameofyouproject_DIALOG.

Or

Method 2:

1. Click on the tools menu>Customize>Click the toolbars tab.

2. Check Controls from the toolbars list box>Click the close button.