can you help me how to display an equivalent color once an input letter matches its first character for example b is for blue, r for red and so on.
letter colors
b or B blue
r or R red
g or G Green
y or Y yellow
other Letter -unknown color

Recommended Answers

All 4 Replies

We can help you. How far have you got? Do you know how to get input from the user?

Displaying color is something which is system-dependent; there are no standard C++ libraries which have any concept of colors. What operating system (e.g., Windows, Linux, MacOS) is this running under? Which compiler are you using? Are you using the system routines (if any) or a platform-independent third-party library such as Qt or GTK+? Is this to be in a console application, or a windowed GUI application? Just what do you mean by 'display an equivalent color': do you want to show a box or swatch filled with the color, or do you want the text changed to that color, or something else? Is this a simple example program, or part of a larger project?

maybe these can helps:

const int BLACK         = 0;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.