Problem Statement Given four points of the form: x1,y1,x2,y2,x3, y3,x4, y4 - create a program that will determine the intersection of the line segment containing (x1,y1) and (x2, y2) and the line segment containing (x3,y3) and (x4,y4) Input Input starts with a number N and is followed by N pairs of line segments (represented by 8 integers) Output A set of N pairs of points indicating the intersection of the N pairs of segments. In case the line segments don't intersect - then the output will be, "do not intersect". If the points do not form two lines / or intersects more than once then the output will be "invalid input". Limits 1

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question
Create c program that will show the sample output and please answer it correctly
✓ Allowed languages
C
Problem Statement
Given four points of the form: x1,y1,x2,y2, x3, y3,x4,y4 - create
a program that will determine the intersection of the line
segment containing (x1, y1) and (x2, y2) and the line segment
containing (x3,y3) and (x4,y4)
Input
Input starts with a number N and is followed by N pairs of line
segments (represented by 8 integers)
Output
A set of N pairs of points indicating the intersection of the N
pairs of segments. In case the line segments don't intersect -
then the output will be, "do not intersect". If the points do not
form two lines / or intersects more than once then the output
will be "invalid input".
Limits
1 <N< 20
-100 A 100
Notes
Problems will have test cases that are not listed in their
specification. Your solution must produce the right output for
these hidden test cases.
Sample Input #1
5
-3 1 0 4 2 0 4 3
-3 1 0 4 2 0 4 -1
-3 1 0 4 -3 1 1 5
-3 1-3 1-3 1 2 5
0 1 0 4 1 1 1 4
Sample Output #1
-2 2
do not intersect
invalid input
invalid input
do not intersect
Copy
Copy
Transcribed Image Text:✓ Allowed languages C Problem Statement Given four points of the form: x1,y1,x2,y2, x3, y3,x4,y4 - create a program that will determine the intersection of the line segment containing (x1, y1) and (x2, y2) and the line segment containing (x3,y3) and (x4,y4) Input Input starts with a number N and is followed by N pairs of line segments (represented by 8 integers) Output A set of N pairs of points indicating the intersection of the N pairs of segments. In case the line segments don't intersect - then the output will be, "do not intersect". If the points do not form two lines / or intersects more than once then the output will be "invalid input". Limits 1 <N< 20 -100 A 100 Notes Problems will have test cases that are not listed in their specification. Your solution must produce the right output for these hidden test cases. Sample Input #1 5 -3 1 0 4 2 0 4 3 -3 1 0 4 2 0 4 -1 -3 1 0 4 -3 1 1 5 -3 1-3 1-3 1 2 5 0 1 0 4 1 1 1 4 Sample Output #1 -2 2 do not intersect invalid input invalid input do not intersect Copy Copy
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning