Question: Build and run Lab4A.cpp //C++ Lab4A.cpp #include ; #include ; #include ; using namespace std; int main ( ) { double a[] = {1, 0,

Build and run Lab4A.cpp //C++ Lab4A.cpp #include ; #include ; #include ; using namespace std; int main ( ) { double a[] = {1, 0, 0}; double b[] = {0, 1, 1}; double c[] = {1, 1, 1}; double d[] = {0, 0, 1}; double ab = sqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); double ac = sqrt( (a[0]-c[0])*(a[0]-c[0]) + (a[1]-c[1])*(a[1]-c[1]) + (a[2]-c[2])*(a[2]-c[2]) ); double ad = sqrt( (a[0]-d[0])*(a[0]-d[0]) + (a[1]-d[1])*(a[1]-d[1]) + (a[2]-d[2])*(a[2]-d[2]) ); //double x = A( a, b);

cout << " ab=" << ab << " ac=" << ac << " ad=" << ad;

cout << "Result " ; //system("pause"); return 0; } 1.2 Next, copy the class to Lab4B.cpp, and replace the individual distance calculations by calls to a single function that computes the distance between two points passed in as parameters. Also, implement the function. Make sure that your modified program compiles and runs, and gives the same output as before. Also, make sure your name is in the comment at the top. PLEASE WRITE THE CODE FOR THIS.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!