Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read carefully. Must read user inputs into structs. Also must use functions. 13.24 Structs-Ex1 Requirements (Read Carefully) Define a structure data type that holds

Please read carefully. Must read user inputs into structs. Also must use functions. image text in transcribed
13.24 Structs-Ex1 Requirements (Read Carefully) Define a structure data type that holds three double data members (kyz) * 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 returms 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 Eucidean norm of the vector defined as to the functionmed thad Create a function named addVect that takes two vector structures and returns a vector structure with the sum of both vectors passed . Create a function named distVect that takes two vector structures and returns the Euclidean distance between the two vectors defined as distance =Ne-ar +02- +(2- . Create a function named prodVect that takes two vechor structures and returns the scalar product of both vectors defined as Create a function second vector defined below If the norm of v2 is zero then return named projVect that takes two vector structures and neturns the scalar projection of the frst vector onto the = 121 IV2I 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 O angle =cos-1 ( v1 . v2). 180 Tasks (Read Carelully) 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 'vi after every line vi: (1o.407-40, 3.00) v21 11.40, 2.40, 1-30) v2vi: 111.60, 9.80,4.30) v2-vi: -9.00 -5.00, -1.70) normtvl): 13.11 dist (vi,v2)1 10.44

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

2. How can competencies be used in employee development?

Answered: 1 week ago