

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Assignment # 20 Points Assigned: 07/10/2009, Friday Due: 07/17/2009, Fri, 11:59 PM At this point in the semester we have discussed how to use header files. Most, if not all of the remaining homework problems will require you to declare and define functions using a pX.c and a pX.h file. The pX.h file will then be included from our file which contains the main() function and your functions will be tested from our main() function. Please be sure to pay close attention to the name of the files specified.
b. struct point getTheCenter(struct rectangle r); - This will compute the center of thegiven rectangle. If the x or y coordinate of the center point is not an integer, just store its truncated value in the point structure returned. c. struct rectangle shiftTheRectangle(struct rectangle r, int x, int y); - This will shift the given rectangle by the specified units in the respective direction. It returns the modified rectangle. d. int isItInYou(struct rectangle r, struct point p); This returns 1 if p lies within r and 0 otherwise. Put the declarations of these functions into p2.h and put there definitions into p2.c. p2.h will be included from our driver file and tested using our main() function.
cd assign ls p1.h p2.c p2.h p3.c p3.h .. tar cvf assign7.tar p1.h p2.c p2.h p3.c p3.h ls