You get two projects to start the lab. Download a ZIP'ed copy of the Lab 8 projects and store it in the C:\FILES directory.
Go into the MS-DOS prompt and execute the following commands:
The driver program Color100.cpp plots four functions that you will write. You will use the mouse to move between these functions, just like you did in Lab 7.
"Templates" for the four functions you will modify are found in Funky.cpp. These functions receive two integers as arguments and return an EzWindows color. The driver function will divide the screen into 100 squares, 10 on each side. These squares will be addressed by their x and y co-ordinates, integers from zero to nine. Your program will be called with each of the 100 possible co-ordinate pairs and will be expected to return a color for the corresponding squares. Examine Funky.cpp and then build and execute Color100 to learn a bit more about the process.
0 | Returns Red , if x > y;
White , if x equals y; and
Blue , if x < y
|
1 | Returns values that cause the window to resemble the flag of Ireland (three vertical stripes: green, white, and red) or any other European country. |
2 | Returns values that cause the window to resemble the flag of the state of North Carolina, but without the seal. |
3 | Returns values that cause the window to resemble the flag of the United States, but without the stars. |
Go ahead and look at Funky.cpp
to see how these functions should look. The function MyFunc0
sets the foreground to blue for characters corresponding to digits and
to yellow for all other characters. The background is set to green
for vowels and to red for non-vowels.
Build and execute the project to see it run.
0 | Sets the background to blue for all characters. Sets the foreground to red for characters that are hexadecimal digits and to blue for all other characters. |
1 | Sets the background to black for all letters in your last name and to white for all other characters. Sets the foreground to green for all letters in your first name and to red for all other characters. |
2 | Sets the foreground to black for all characters. Sets the background so that each of the colors red, green, blue, and yellow appears at least nineteen times. |