Question: C Programming. Task: Main: Source.c: Source.h: Vector 1. Implement function double vectorlength(double x, double y, double z) It calculates the length of a three-dimensional euclidean

C Programming.

Task: C Programming. Task: Main: Source.c: Source.h: Vector 1. Implement function double

Main:

vectorlength(double x, double y, double z) It calculates the length of a

Source.c:

three-dimensional euclidean vector. 2. The function gets three arguments that represent the

Source.h:

components of a vector in the three-dimensional space. 3. The function should

Vector 1. Implement function double vectorlength(double x, double y, double z) It calculates the length of a three-dimensional euclidean vector. 2. The function gets three arguments that represent the components of a vector in the three-dimensional space. 3. The function should return the length of the vector. All numbers should be double -precision floating point numbers. 4. Implement vectorlength function in the source.c file. When your function works properly, upload the program below. If you have forgotten about vector mathematics, you can find additional information from this Wikipedia entry. You will need to calculate square root that is not part of C's basic operators, but there is a sqrt function in the math library that you can use. With pow function you can calculate the power of a value, although it might be easier just to use multiplication for this particular exercise. Important To use sqrt function and pow function, include math.h header in your source file. We must also use - Im option in end of the compilation command to link math library like below: gcc -std=c99 -Wall -g -o main source.c-Im The provided exercise templates have this set up already. - main.c x source.c in source.h 1 #include 2 #include "source.h" 3 40 int main(void) 5 { 6 /* Feel free to modify this code to test with different inputs */ 7 printf("Length of vector (1,2,3): %f ", vectorlength(1,2,3)); printf("Length of vector (1,1,1): %f ", vectorlength(1,1,1)); 9 printf("Length of vector (1,0,0): %f ", vectorlength(1,0,0)); 10 printf("Length of vector (0.3, 0.3, 0.1): %f ", 11 vectorlength(0.3, 0.3, 0.1)); 12 } 13 8 ic main.c c source.c x source.h 1 #include 2 #include VOEWNP 5 6 c main.c source.c source.h x 1 Houble vectorlength(double x, double y, double z); 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!