Question: Programming C Language. Define a structure variable pt which represents a point in Cartesian xy-plane using its coordinates (x, y). Using pt, define an array

Programming C Language.

Programming C Language. Define a structure variable pt which represents a point

Define a structure variable pt which represents a point in Cartesian xy-plane using its coordinates (x, y). Using pt, define an array of 3 pt structures called triangle which represents the 3 vertices of a triangle in the xy-plane. Write a function with the following prototype which accepts the triangle array as an argument and returns the perimeter of the triangle. float perimeterCalc(pt , int) The 3 co-ordinates of the 3 points are randomly generated. The allowed values for both x & y are between -5.0 & 5.0 (with one decimal point). Print the calculated perimeter in the main() using precision of 2 decimal points. Note: The distance between two cartesian points of coordinates (x1,y1) & (x2.y2) is calculated as followss = (21 - 32) + (91 - 32)2 Use #include to access the square root function ( sqrt (number) )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!