Due: Monday, Oct 27 by 11:59 PM
If you have a solution open in Visual Studio, close it (File->Close Solution).
Download CS200_Lab22.zip. Import it into Visual Studio (File->Import...).
Add your code to the source file called Draw.c.
In this lab, you will implement a function called draw_rectangle, which draws a rectangle on the screen using text characters.
The draw_rectangle function has three parameters:
struct rect contains the following fields:
You can draw the rectangle either as a solid block of characters, or you can just draw the outline. You can use any character to print the rectangle.
The file Console.h, under "Header Files" in the Solution Explorer, describes the functions available for you to call.
In order to choose the color of the characters you draw, call the cons_change_color function. This function takes two parameters, representing the foreground and background colors to use.
In order to draw the rectangle at the specified position on the screen, you can call the cons_move_cursor function, which moves the cursor to the specified row and column. The general idea is, for each row of the rectangle, move the cursor to the beginning of the row, and then use cons_printw to draw each character in the row. (This function works exactly like printf.)
Once you have implemented the draw_rectangle function, you can run the program using the already-implemented main function. The program draws a number of random rectangles of different sizes and positions on the screen. When the program finishes, the screen should look something like this:
When you are done, choose Tools->Submit to submit your completed lab to the server. You will need to enter your Marmoset username and password.
If the Tools->Submit option does not work, create a zip file containing the files in your project, and upload it to the submission server as lab22. The server URL is