- Create a structure as shown below to represent a point in the Cartesian plane:
typedef struct {

double x;

double y; }Point;

- Create a second structure that models a line segment, which consists of two points, using the structure definition as shown:
typedef struct {

Point start;

Point end; }Line_segment;

- Write a void function that has one parameter of type Point and displays that point to the console in the form (x, y).
- Write a void function that has one parameter of type Line_segment and displays that line segment to the console in the form P1, P2 (where P1 and P2 will be displayed using the function in step 3 above).
- Write a void function that has one parameter of type Point, and displays the position of that point on the Cartesian plane (origin, x-axis, y-axis, Quadrant I, Quadrant II, Quadrant III, or Quadrant IV).
- Add the function calculate_length to your program. This function should take one parameter of type Line_segment and return its length.

Steps 7-9 should be done in main:

- Declare two Point variables, p1 and p2. Prompt the user to enter coordinates for each. Display each point using the function from step 3.
- Create a Line_segment variable and use the user-entered points as start and end. Display the line using the function from step 4.
- Call the function from step 4 and output the result with 3 decimal places.
- Test your program thoroughly.

### Like this:

Like Loading...

*Related*