Question
In C language Implement main with an array of 5 points (marks), reads in 4 points from the user by calling getLabel() 4 times. Find
In C language
Implement main with an array of 5 points (marks), reads in 4 points from the user by calling getLabel() 4 times.
Find and display the distance (gap) between the 1st and 2nd points, and 3rd and 4th points using function gap.
Find and display the slope of the line between the 1st and 2nd points, and the 3rd and 4th points using function slope.
Create a 5th point by calling perpLabel() using 1st and 2nd points.
Code is provided below
_____________________________________________________________________________________________________________________________________________________________
#include
struct mark_struc { double xax; double yaz; char tag[25]; }; typedef struct mark_struc Label;
Label getLabel(); // get a point(Label) from the user (stdin)
double gap(Label mk1, Label mk2); // return the distance between mk1 (point1) and mk2(point2)
double slope(Label mk1, Label mk2); /* find slope of the line at mk1 and going to mk2 */
void perpLabel (Label mk1, Label mk2, Label *mk3); /* calculate the pt3 from mk1 to mk3 is perpendicular to the line from mk1 to mk2 */ int main() { Label aArray[5]; //finsh main return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started