Question: Instructions: - Step 1 : Write the C source code ( named as pe 2 . c ) with vim by using the
Instructions:
Step : Write the C source code named as pec with vim by using the command: vim pec
a Write a function to find and return the slope of a line. The equation to calculate the slope from two points is given as: mfracyyxx Call this function twice to compute m and m
b Write a function to find and return the y intercept of a line. Note that the y intercept of a line is the value of y at the point where the line crosses the y axis, ie when x Call this function twice to compute b and b
c Write a function to compute and return the angle between the two lines. Note that the angle theta between the lines having slope m and m is given by thetaarctan leftfracmmm mright You may use atan function given in math. h to compute arctan
d Write a function to print the two line equations, check if the two lines are parallel or intersect using the angle between the two lines. Note that if thetaepsilon where epsilon is a predefined small number, we assume the lines are parallel.
Step : Build your executable program named as pe by using the command: gcc o pe pec
Step : Run the program by using the command: pe
Step : Test your code with the provided "testsh file by using the command: testsh pec
Note : You should have the "testsh in the same directory as your source code.
Note : You should see "PASS" for all the test cases.
Step : Submit your source code pec to Learn.Hub assignment PE
Sample Result
ZafersMacBookPro:src zafer$ fpex
Enter coordinates of two points on line xyxy:
Enter coordinates of two points on line : xyxy:
The equation of l: y x
The equation of : y x
l and l lines intersect, and the angle between the two lines is
ZafersMacBookPro:src zafer$ fpex
Enter coordinates of two points on line xyxy:
Enter coordinates of two points on line : x yxy:
The equation of l: y x
The equation of : y x
l and l lines are parallel, and the angle between the two lines is
ZafersMacBookPro:src zafer$ fpex
Enter coordinates of two points on line xyxy:
Enter coordinates of two points on line :xyxy:
The equation of : y x
The equation of l: y x
l and l lines intersect, andthe angle between the two lines is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
