Link to home
Start Free TrialLog in
Avatar of edelossantos
edelossantos

asked on

3d Distance array

can any one provide a simplistic code for a 3d array?  This is for homework.  This what I have so far.

void input_fun(Point &, &);
double calculate_fun(Point, Point);
void print_fun(double distance);

struct Point {

      double x;
      double y;
      double z;

};

      Point p1, p2;      

      double distance;

      input_fun(p1, p2);
      distance = calculate_fun(p_array);
      print_fun(distance);

      return 0;

}

void input_fun(Point &p1, &p2) {

      cin >> p1.x >> p1.y >> p1.z;
      cin >> p2.x >> p2.y >> p2C.z;
}

double calculate_fun(Point p1, Point p2) {

      double distance;
      
      distance = sqrt(p1.x -p2.x....

      return distance;

}

void print_fun(double distance) {

      cout << "distance = " << distance << endl;

}

I am looking for the modified working code.  This is for a homework assignment.  CMPS 222
ASKER CERTIFIED SOLUTION
Avatar of PerryDK
PerryDK

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial