Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions