6. A three-dimensional vector has the form: A = (x, y, z) can be represented as: given the vectors: Example:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 4PP
icon
Related questions
Question

6. A three-dimensional vector has the form:

A = (x, y, z)

can be represented as:

given the vectors:

Example:

Their sum is:
Example:

struct VECTOR { double x; double y; double z; };

A = ( a, b, c ) (5, 6, 2)

and

B = ( d, e, f ) (3, 1,9)

A + B = ( a + d, b + e, c + f ) (5 + 3, 6 + 1, 2 + 9)

= (8, 7,11)
A B = a x d + b x e + c x f

Their scalar product is:
(result is a scalar) example: 5 x 3 + 6 x 1 + 2 x 9 = 39

Write the complete definition code for the functions:

a. calc_sum computes and returns the sum of two vectors

b. scalar_prod computes and returns the scalar product of two vectors

6. A three-dimensional vector has the form: A= (x, y, z)
can be represented as:
struct VECTOR {
double x;
double y;
double
Z;
};
given the vectors:
A = (a, b, c)
and
(d, e, f )
B =
Example:
(5, 6, 2)
(3, 1,9)
Their sum is:
A +B =
(а + d, b + е, с + f)
Example:
(5 +3, 6 + 1, 2 +9)
= (8, 7,11)
||
Their scalar product is:
АВ 3 а хd +bxе+сxf
(result is a scalar)
example:
5 х3 +6х 1 + 2 х 9 %3D 39
Write the complete definition code for the functions:
calc _sum
computes and returns the sum of two vectors
а.
b. scalar_prod
computes and returns the scalar product of two vectors
Transcribed Image Text:6. A three-dimensional vector has the form: A= (x, y, z) can be represented as: struct VECTOR { double x; double y; double Z; }; given the vectors: A = (a, b, c) and (d, e, f ) B = Example: (5, 6, 2) (3, 1,9) Their sum is: A +B = (а + d, b + е, с + f) Example: (5 +3, 6 + 1, 2 +9) = (8, 7,11) || Their scalar product is: АВ 3 а хd +bxе+сxf (result is a scalar) example: 5 х3 +6х 1 + 2 х 9 %3D 39 Write the complete definition code for the functions: calc _sum computes and returns the sum of two vectors а. b. scalar_prod computes and returns the scalar product of two vectors
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr