Home > Back-end >  The code what's the problem?
The code what's the problem?

Time:04-19

//the header file
# pragma once
#include
The class SD_Point
{
Float x, y;
Public:
Void Set_Point (float, float);
Float Get_X ();
Float Get_Y ();
Void Get_Point ();
SD_Point ();
SD_Point (float, float);
Float operator * (SD_Point);
Friend ostream& Operator<(ostream& , SD_Point & amp;);
};

//implementation file
# include "SD_Point. H"
#include
#include
using namespace std;

SD_Point: : SD_Point ()
{
X=y=0;
}

SD_Point: : SD_Point (float x, float y)
{
This - & gt; x=x;
This - & gt; Y=y;
}

Void SD_Point: : Set_Point (float x, float y)
{
This - & gt; x=x;
This - & gt; Y=y;
}

Float SD_Point: : Get_X ()
{
Return the x;
}

Float SD_Point: : Get_Y ()
{
The return of y;
}

Void SD_Point: : Get_Point ()
{
Cout & lt; <"(" & lt; }

Float SD_Point: : operator * (SD_Point point)
{
Float d;
(d=(float) SQRT (pow this - & gt; X - point x, (2) + pow this - & gt; Y - point. Y, 2));
Return d;
}

Ostream & amp; The operator & lt; <(ostream& Out, SD_Point & amp; Point)
{
The out & lt; <"(" & lt; Return the out;
}

//contains the main function of file
# include "SD_Point. H"
#include
using namespace std;

Int main ()
{
SD_Point point (1, 3);
Cout & lt; }

CodePudding user response:

Thank you,
  • Related