Friday, March 25, 2011

C++ Programming Lab - Program 2

/ * Program to find the sum of two Surface points */

 

#include<iostream.h>

void main()

{

struct point

{

int x,y;

 

};

 

point p1,p2, p3;

cout<<" Enter coordinates for P1:";

cin>>p1.x>> p1.y;

cout<<"Enter coordinates for P2:";

cin>>p2.x>>p2.y;

 

p3.x=p1.x+p2.x;

p3.y=p1.y+p2.y;

cout<<"coordinates of P1 + P2:"<<p3.x<<","<<p3.y;

}

No comments :

Post a Comment