Logo  

CS256 - Fundamentals of Structured Programming

Displaying exercises/e9/files/c1.c

#include "c.h"

/**
 * Complete the function to:
 * 1) Clear the screen
 * 2) draw a person figure where the upper left corner of the person is located
 *    at the x,y position.  Hint: The person is 4 lines of text, start the cursor
 *    for each line at the left side, keeping the column (x) fixed, increase the
 *    line (y) by one for each line of the person.
 *   o
 *  /T\
 *   |
 *  / \
 * 3) Refresh the screen
 */
void person(int x, int y)
{
  
}

/**
 * Complete the main function that uses the above function to draw a person
 * figure that is moved around using the keyboard arrow keys.
 * 1) Start the person roughly in the middle of the screen.
 * 2) When a q or a Q is typed, exit the program.
 * 3) Make sure that the person figure does not leave the screen area. Keep in
 *    mind that the x,y position of the person is in the upper left corner of
 *    the person.
 */
int main(void)
{
  init_curses();

  // Put your main code here.
  
  leave_curses();
  return 0;
}