Reference no: EM132153454
I am having trouble with the creating the following program in C programming. Please check to make sure the answer is correct because I have had some issues recently with programs provided not working properly. Please make it as simple and basic as possible. Here is the program I need help with:
Create a pointer structure that has members for the x and y coordinates. Use typedef to make a point_t data type. Create a rectangle structure that has a point_t member for the upper left corner of the rectangle, but also a float for the height and a float for the width. Use typedef to make a rectangle_t data type.
Create a function called is_in() that takes in a point_t variable and a rectangle_t variable, both by reference, and returns 0 if the point is not in the rectangle and 1 if the point is in the rectangle.
Use computer science y-axis (i.e., the origin is in the upper left corner of the screen and y values increases further down the screen).
Write a program that gets a point from the user and the point for the upper left corner and dimensions of a rectangle and then tells whether the point is in the rectangle or not.
Sample Runs:
Enter a point (x and y): 0.0 0.0
Enter a rectangle (x, y, width, and height): -50.0 -50.0 100.0 100.0
Point is inside the rectangle
Enter a point (x and y): 200.0 200.0
Enter a rectangle (x, y, width, and height): -50.0 -50.0 100.0 100.0
Point is outside the rectangle