Home > Back-end >  Why will appear this kind of problem, please
Why will appear this kind of problem, please

Time:10-11


The code is as follows:

 # include 
#include
using namespace std;
Struct Point {
Int x, y, z;
};

Void input (Point p) {
cout <"Both Please difference your point:";
Cin & gt;> P.x & gt;> P.y & gt;> P.z;
}

Void print (Point p) {
cout <"(" & lt; }

Double cal_dis (Point p1, Point p2) {
Return SQRT ((p1) X-ray p2) x) * (p1) X-ray p2) x) + (p1) y - p2) y) * (p1) y - p2) y) + (p1. Z - p2. Z) * z (p1) z - p2)));
}

Int main () {
Point p1, p2,
Input (p1);
Print (p1);
Input (p2);
Print (p2);
Double short=cal_dis (p1, p2);
cout <"Short=" & lt; }

CodePudding user response:

Where is the input of what went wrong?

CodePudding user response:

Value passed
You internal to a function parameter assignment
Nothing to do with the arguments
The equivalent of
Point p1.
Point p=p;
Cin & gt;> p;
cout You give p input data output p1 but expect to see p data which is not

CodePudding user response:

Thank you very much!
  • Related