Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements (Read Carefully) . Define a structure data type that holds three double data members (x.yz) . Define an alias for this data type named

image text in transcribed

Requirements (Read Carefully) . Define a structure data type that holds three double data members (x.yz) . Define an alias for this data type named vector (using typedef. . Create a function named initVect that receives three double numbers and returns vector structure initialized with the values passed to the function where the first parameter is the value for data member x and the last one for data member z. Create a function named invVect that takes a vector structure and returns the inverse of the vector (negative value of each data member: xyz). Create a function named normVect that takes a vector structure and returns the Euclidean norm of the vector defined as . . Create a function named addVect that takes two vector structures and returns a vector structure with the sum of both vectors passed to the function. Create a function named distVect that takes two vector structures and returns the Euclidean distance between the two vectors defined as: . . distance V (2-z1) (2 y)(22-z1)2 .Create a function named prodVect that takes two vector structures and returns the scalar product of both vectors defined as: . Create a function named projVect that takes two vector structures and returns the scalar projection of the first vector onto the second vector defined beloW. If the norm of v2 is zero then return 0 proj Create a function named angleVect that takes two vector structures and returns the angle in degrees between the two vectors defined below. For computing the cosine inverse use the function acos. Use Pl = 3.14159265. If the norm of any of the two vectors is zero then return 0. . 180 angle = cos-1 (w111:21) Tasks (Read Carefully) Create a program that reads two vectors from the user as follows: (10.4, 7.4, 3.0) (1.4, 2.4, 1.3) Then have your program output the following (add In' after every line) 1 (10.40,7.40, 3.00) V2: (1.40, 2.40, 1.30) V2 t vl: (11.80, 9.80, 4.30) V2v1: (-9.00, 5.00, 1.70) norm (v) 13.11 norm (v2) 3.07 dist (v1,v2) 10.44 prod (vl,v2) 36.22 proj (vi,v2) 11.81 proj (v2, V1): 2.76 angle (v2, 25.77

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

Students also viewed these Databases questions