Question: Help on this problem using C++ (xterm, term) Complete the following requirements in a single C++ program: - Define a structure called Point which will
Help on this problem using C++ (xterm, term)
Complete the following requirements in a single C++ program:
- Define a structure called Point which will represent an x,y coordinate. Point should have 2 members, x and y, stored as doubles.
- Request x,y coordinates from the user. The program should collect x,y points until the user enters "q" or "Q". The user should be allowed to store as many points as they would like.
- Write a function that calculates the average x,y point from a list of points passed to the function and return a new point containing this value. Pass your user collected points to this function. If 0 points are passed to this function, return a point containing 0,0 as its coordinates.
- Write a function that finds the maximum distance between any two points from a list of points passed to the function and return that distance. Pass your user collected points to this function. Return -1 if there are 1 or fewer points in the list passed to this function. Distance values returned should always be positive.
- Write a function that computes the largest triangle that can be created from the list of points passed to the function. Create a triangle structure that contains three pointers to Point structs and return that structure from the function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
