Aim : A point on the two-dimensional plane can be represented by two numbers: An X coordinate and a Y coordinate. For example, (4, 5) represents 4 units to the right of the origin along the X axis and 5 units up the Y axis. The sum of two points can be defined as a new point whose X coordinate is the sum of the X coordinates of the points and whose Y coordinate is the sum of their Y coordinates. Write a program that uses a structure called point to model a point. Define three points, and have the user input values to two of them. Then set the third point equal to the sum of the other two, and display the value of the new point. Interaction with the program might look like this: Enter coordinates for P1: 3 4 Enter coordinates for P2: 5 7 Coordinates of P1 + P2 are: 8, 11.

Theory Functions (Methods):

User-Defined Data Type:

The Point structure creates a new data type that represents a point in a 2D space. This allows you to work with points as single entities in your code.

Functions and Structures:

The addPoints function operates on Point structures, demonstrating how functions can be used to manipulate and process user-defined data types. Although this isn't a method that belongs to the structure, it is a function that operates on the structure, and thus is a key part of the programs functionality.

Syntax:


return_type function_name(parameter_list) {
// function body
return return_value;
}
Program :

Conclusion : Hence we have performed our practical successfully