Thursday, 23 June 2011

A program to assign values of 10 and 12 to X and Y coordinates of a point

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>

struct point
{
  float x;
  float y;
 public :

   void getxy (float xcord, float ycord)
   {
    x=xcord;
    y=ycord;
   }
   void showxy ()
   {
      cout<<"X coordinates = "<<x<<endl;
      cout<<"Y coordinates = " <<y;
   }
};

main()
{
   point p;
   clrscr();
   p.getxy(10, 5);
   p.showxy();
   getch();
}

0 Comments:

 

blogger templates 3 columns | Make Money Online