Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions