Dates:
Homework Policy
All the work for Part 8A must be entirely your own.
You may consult books and the course instructors, but nothing else.
You may work with other students on Part 8B.
At the top of your program, put the names of any others that
you have worked with. You must completely understand all
work that you submit.
"On my honor as a University of Colorado at Boulder student, I have neither received nor given unauthorized assistance on this work."
Due at 9:30am, Tuesday, Oct 22. No late submissions accepted for credit.
Write a function that will draw a sequence of figures on a graphics screen that has previously been opened. The specification for the function is:
void drawFigures(int x[], int y[]); // The function draws a sequence of white lines connecting the // (x[0],y[0]) to (x[1],y[1]) to (x[2],y[2]) to (x[3],y[3]) and // so on until a negative x coordinate is found. When a negative // x coordinate is found, the figure is ended in one of these ways: // -- // If x is -1, then the function ends with no more work. // -- // If x is -2, then the function draws one more line from the last // point of the figure back to the first point of the figure. Then // the function ends. // -- // If x is -3, then the function ends the current figure, and the // next xy pair is the first point of a new figure. // -- // If x -s -4, then the function draws one more line from the last // point of the figure back to the first point of the figure. Then // the next xy pair is the first point of a new figure. // --Note: In order for Dora to correctly grade your work, the start of each figure must begin with a call to the
moveto
function
from the winbgim library. Each of the lines must be draw by using the
lineto
function. No other calls to moveto
or lineto
are permitted.
The program must work correctly regardless of how large the array is.
y Your submission to Dora should include a small main function that tests the drawFigures function in some simple way.
Due at 9:30am, Tuesday, Oct 29. No late submissions accepted for credit.
Write a main program that allows the user to use the mouse to draw figures that contain up to 1000 points. Except for ending the program, the only user input is from the mouse. As a minimum, your program must allow the user to:
getmouseclick
.