Question: Project 3 Working withPoints and Structs Your code must use the following structure: struct point_struct { double xcoor; double ycoor; char label[25]; }; typedef struct
Project 3
Working withPoints and Structs
Your code must use the following structure:
struct point_struct { double xcoor; double ycoor; char label[25]; }; typedef struct point_struct Point;
the following functions must be created:
Point getPoint(); // read in a point from the user (stdin)
double distance(Point pt1, Point pt2); // return the distance between pt1 and pt2
double slope(Point pt1, Point pt2); /* calculate the slope of the line starting at pt1 and going to pt2 */
void perpPoint (Point pt1, Point pt2, Point *pt3); /* calculate pt3 such that a line from pt1 to pt3 is perpendicular to the line from pt1 to pt2, and the distance between pt1 and pt2 is the same as the distance between pt1 and pt3 */
Grading:
10 points function getPoint ()
15 points function distance()
15 points function slope()
15 points function perpPoint()
10 points create a main that has an array of 5 points and
reads in 4 points from the user by calling getPoint 4 timesdisplays the distance between the 1st and 2nd points, and the 3rd and 4th pointsdisplays the slope of the line betweenthe 1st and 2nd points, and the 3rd and 4th pointscreates a 5th point by calling perpPoint() using the 1st and 2nd points
note: in c please
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
