Question: Write a program for 2D points Create a struct for 2D points (x, y) that can have values of type double Get 2 points from

Write a program for 2D points

  • Create a struct for 2D points (x, y) that can have values of type double
  • Get 2 points from user
  • Calculate distance between the points
  • Find the mid-point of the 2 points
  • You should have different functions
    • Get input from user and save in struct
    • Calculate distance between the points
    • Create and return a new point which is the mid-point of the input two points

/* a4.c file */
#include<stdio.h>
#include"point.h"
int main(int argc, char *argv[])
{
    int N=2;
    Point points[2];
    // Call a function which gets N points from user
    // Find distance between two points and print it here
    // Call a function that calculates mid-point for two input points and returns the new point. Print this mid-point here.
    return 0;
}

/* point.h file */

/* point.c file */

Step by Step Solution

3.35 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To complete the task of writing a program that handles 2D points we need to cover several steps Here we will create a simple program with appropriate ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!