.

CAB202 Topic 3, Exercise 1: Draw Rectangle 1

Requirements:

Complete the implementation of the draw_rect function. This function augments the ZDK by adding the ability to draw rectangular boxes. The hash-tags for this exercise are: #cab202 and #cab202DrawRect1.

This exercise will give you practice with the drawing functions in the ZDK and the use of global variables to transfer data between functions. Given the definition of a rectangle, you will complete a function that draws the outline of the rectangle using pre-existing functions defined in the ZDK. This function does not return a result.

To complete the program, follow the instructions detailed in the in-line comments in the draw_rect() function.

Notes

  • The supplied test driver produces output similar to that shown below.
    CAB202 Topic 3, Exercise 1: Draw Rectangle 1
  • Use this test driver to implement and test your function prior to submission.

Things to avoid

  • Don’t rely on anything you do in your main function. AMS will compile your submission as part of a larger program and call setup() and process() as necessary to test functionality. To allow this to work, any main function in your submission will be automatically removed.
  • Don’t directly use ncurses or standard I/O functions such as printf(). AMS is looking for a ZDK screen.
.