Question: Please write the code using c! Also please show the compilation of the code! Thank you. belo 2. If n points are connected to form
Please write the code using c!
Also please show the compilation of the code!
Thank you.






belo 2. If n points are connected to form a closed polygon as shown of the polygon can be computed as Notice that although the illustrated polygon has only six distinct corners, n fo this polygon is 7 because the algorithm expects that the last point, (xe be a repeat of the initial point, (t'o> yo). Or 6 6), Wi 0 90 x1V1) (xo,Yo) (X6,V6) (x2,V2) (x3,y3) (x5.V5) (x4-Y4) n7 Programming Projects 447 Represent the (x, y) coordinates of the connected points as two arrays of at most 20 type double values. For one of your tests, use the following data set, which defines a polygon whose area is 25.5 square units. 0 7.5 7.5 4 4 0 0 Implement the following functions: get_corners-Takes as parameters an input file, arrays x and y, and the arrays' maximum size. Fills the arrays with data from the file (ignoring an data that would overflow the arrays) and returns as the function value the number of (a, y) coordinates stored in the arrays. utput_corners-Takes as parameters an output file and two type double arrays of the same size and their actual size, and outputs to the file the contents of the two arrays in two columns. polygon_area-Takes as parameters two arrays representing the (x, y) coor dinates of the corners of a closed polygon and their actual size and retur as the function value the area of the closed polygon. If n points are connected to form a closed polygon, Requirements: You must follow the description in the book, with one exception. Instead of reading in an input file, I want you to use file redirection. You must use the file: x_y_polygon.txt (in /public/csci112 as your input.) /lab4/csci112*/lab4/x_y_polygon.txt This file contains the x and y points as in the book. So the answer you receive will match the book's answer. Print the answer to the screen, not to a file. Do not hardwire a number (7) in get_corners or any of the other functions. Print the area aftet you print the table of x and y coordinates. NO GLOBALS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
