Assignment: Determining Background and Foreground Color
In the days of yesterday (hear the theme to the Lone Ranger), there were only 16 foreground and background colors; each numbered 0 to 15. White was represented by 15 and black by 0.
Each pixel on the screen had a single byte that stored the background and foreground color. The upper four bits of the byte were the foreground color and the background color was the lower four bytes. (Remember, a single byte can only hold the numbers 0 to 255 in binary).
Write a program that will ask the user for the value that the byte contains then it will tell the user what the foreground and background colors are.
Then, write another program that when given the foreground and background colors it will then display the value that the byte will contain.
Error checking on input for these program is required!!!!!
Output should display the color name and the color value!!!!
Here are what the colors were back in the "good old days:"
0 = Black
8 = Gray
1 = Blue
9 = Light Blue
2 = Green
A = Light Green
3 = Aqua
B = Light Aqua
4 = Red
C = Light Red
5 = Purple
D = Light Purple
6 = Yellow
E = Light Yellow
7 = White
F = Bright White.