Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone please help with this urgently: 5. [Collinear Points in a Plane, 50 points] Implement a program that reads N points in a plane
Can someone please help with this urgently:
5. [Collinear Points in a Plane, 50 points] Implement a program that reads N points in a plane and outputs any group of four or more collinear points (i.e., points on the same line) command line, read the input from Your program should accept an input file the provided file, which contains the number of input points on the first line, followed by two floating-point numbers representing the x-axis and y-axis for a point on each of the following lines. You may assume that all input points are unique. For the provided points.txt input file, your program should then output to the screen the EC330 Applied Algorithms and Data Structures for Engineers, Spring 2018 collinear points in the format specified in the sample output below (Note that you may print the points as floats or doubles). If there is more than a single group of collinear points, you should separate the groups with an empty line. The ordering of the points within each group does not matter Sample points.txt file (provided), which describes the set of points (1,4.5), (3,4), 1 4.5 Sample output for the above input: (0,0) (2,2) (4,4) For this exercise, you are required to use STL data structures. You may find it useful to define lines with slopes and y-intercepts. Iry to make your implementation as efficient as you canStep 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