Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Files to submit: perimeter.c Time it took Matthew to Complete: 20 mins Requriements Program must compile with both -Wall and -Werror options enabled Submit only

Files to submit: perimeter.c Time it took Matthew to Complete: 20 mins Requriements Program must compile with both -Wall and -Werror options enabled Submit only the files requested Use doubles to store real numbers Print all doubles to 2 decimal points unless stated otherwise Restrictions No global variables may be used Your main function may only declare variables and call other functions Description Write a program called perimeter.c that find the perimeter of an arbitrary shape. Your program will be provided a binary file that contains the vertices of the shape and your program should print out the premiter of the given shape. Additional Details You MUST use a struct in your solution I recommend have a Point struct The name of the binary file will passed as a command line parameter The binary file contains only integers The first integer is the number of points in the file The remaining integers are points representing the vertices of the shape There is an edge between each adjacent point and between the last point and the first point There are at least 3 points in each file The perimeter of a polygon is the sum of the lengths of all of its edges If you really look at the the points in the file you will see that they don't actually represent convex polygons but treat them like the files like they do Examples User input has been underlined to help you differentiate what is user input and what is program output. Hints If you are curious about what is in the file you can use the binaryinteger printing program we wrote in class. Examples In this example assume that the file example.txt contained the following values in binary. I'm displaying the file as text below to help you get an understanding of what the file looks like but remember the file is in binary with no spaces between any of the values. Example 1 3 287 422 283 -981 781 647 ./perimeter.out example.txt The perimeter is 3648.30

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago