structure



A point on the 2-d can be represented by two numbers: an x co-ordinate and a y co- ordinate. For example (4,5) represents a point 4 units to the right of origin and 5 units up the origin. The sum of two points can be defined as a new point whose x co- ordinate is the sum of x co-ordinates of both points and same for y co-ordinates. 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.



No comments:

Post a Comment

Comment Here