Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* file: vector2D.cpp Created by: ?? Creation Date: ?? Synopsis: ?? */ #include #include #include using namespace std; const double EPSILON(1e-12); // function prototypes //

/* file: vector2D.cpp

Created by: ??

Creation Date: ??

Synopsis: ??

*/

#include

#include

#include

using namespace std;

const double EPSILON(1e-12);

// function prototypes

// ENTER FUNCTION PROTOTYPE FOR read_vector HERE.

// ENTER FUNCTION PROTOTYPE FOR vector_length HERE.

// ENTER FUNCTION PROTOTYPE FOR write_vector HERE.

// ENTER FUNCTION PROTOTYPE FOR vector_add HERE.

// ENTER FUNCTION PROTOTYPE FOR vector_subtract HERE.

// ENTER FUNCTION PROTOTYPE FOR scalar_mult HERE.

// ENTER FUNCTION PROTOTYPE FOR normalize HERE.

// ENTER FUNCTION PROTOTYPE FOR perpendicular HERE.

// *** DO NOT CHANGE ANY CODE IN THE MAIN FUNCTION.

int main()

{

double u1, v1; // coordinates of first vector

double u2, v2; // coordinates of second vector

double u3, v3;

double scalar;

read_vector("Enter first vector (2 floats): ", u1, v1);

read_vector("Enter second vector (2 floats): ", u2, v2);

cout << "Enter scalar multiplier: ";

cin >> scalar;

cout << endl;

write_vector("First vector: ", u1, v1);

write_vector("Second vector: ", u2, v2);

cout << endl;

vector_add(u1, v1, u2, v2, u3, v3);

write_vector("Vector add: ", u3, v3);

cout << endl;

vector_add(u1, v1, u2, v2, u3, v3);

write_vector("Vector add: ", u3, v3);

vector_subtract(u1, v1, u2, v2, u3, v3);

write_vector("Vector subtract: ", u3, v3);

scalar_mult(u1, v1, scalar, u3, v3);

write_vector("Scalar multiplier: ", u3, v3);

cout << endl;

write_vector("First vector: ", u1, v1);

write_vector("Second vector: ", u2, v2);

perpendicular(u1, v1, u2, v2);

return(0);

}

// DEFINE FUNCTION read_vector HERE.

// DEFINE FUNCTION vector_length HERE.

// DEFINE FUNCTION write_vector HERE.

// DEFINE FUNCTION vector_add HERE.

// DEFINE FUNCTION vector_subtract HERE.

// DEFINE FUNCTION scalar_mult HERE.

// DEFINE FUNCTION normalize HERE.

// DEFINE FUNCTION perpendicular HERE.

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

Step: 3

blur-text-image

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions