Home > Back-end >  In c/c a great god
In c/c a great god

Time:09-26

 
#include
#include
using namespace std;

The class Point;
Double short (Point & amp; A, Point & amp; B)
{
Double dx=a.x - b.x;
Double dy=a.y - b.y;
Return SQRT (dy dx + dy dx * *);
}

The class Point
{
Public:
Point (double xx, double yy)
{
X=xx;
Y=yy.
};
Void Getxy ();
Friend double short (Point & amp; A, Point & amp; B);
Private:
Double x, y;
};

The void Point: : Getxy ()
{
Cout & lt; <"(" & lt; }

Int main (void)
{
Point p (3.0, 4.0), p2 (6.0, 8.0);
P1. Getxy ();
P2. Getxy ();
Double d=short (p1, p2);
Cout & lt; <"Short is" & lt; return 0;
}

Who knows me this code is wrong, I'm in vs verification passed, but didn't pass in the Gcc

CodePudding user response:

The realization of short to after the Point's statement
I didn't compile this VS,
 # include 
#include
using namespace std;

The class Point
{
Public:
Point (double xx, double yy)
{
X=xx;
Y=yy.
};
Void Getxy ();
Friend double short (Point & amp; A, Point & amp; B);
Private:
Double x, y;
};
Double short (Point & amp; A, Point & amp; B)
{
Double dx=a.x - b.x;
Double dy=a.y - b.y;
Return SQRT (dy dx + dy dx * *);
}

The void Point: : Getxy ()
{
Cout & lt; <"(" & lt; }

Int main (void)
{
Point p (3.0, 4.0), p2 (6.0, 8.0);
P1. Getxy ();
P2. Getxy ();
Double d=short (p1, p2);
Cout & lt; <"Short is" & lt; return 0;
}

CodePudding user response:

 # include 
using namespace std;
The class date;
The class time
{
Public:
Time (int, int, int);
Void dispaly (date&);
Private:
Int hour;
Int minute;
Int the SEC;
};
The class date
{
Public:
The date (int, int, int);
Friend void time: : dispaly (date & amp;);
Private:
Int the month;
Int day;
Int year;
};
Time: the time (int h, int m, int s)
{
Hour=h;
Minute=m;
The SEC=s;
}

Void time: : display (date & amp; D)
{
CoutCout}
Date: the date (int m, int d, int y)
{
The month=m;
Day=d;
Year=y;
}
Int main ()
{
Time t1 (10,13,56);
The date (12,25,2004 d1);
T1. Dispaly (d1);
return 0;
}

Why do I this compilation, however, always appear problem, but can't find,

CodePudding user response:

There are spelling mistakes dispaly

 cout 
A less & lt;
 cout           
  • Related