C 1D array help with 3 problems in it
Question Description
Write a C++ main program that calls each function listed below. Load values into each array using a list to test each function. Print out results to show original array contents and contents after using the functions. All printing should be done in the main programs – do not print from the functions. Turn in copies of the program and all results. Output: The output should clearly show original array contents, new array contents (if modified), and the result. For example, the output for part B might look as follows: Contents of array A before swap: 1 2 3 4 5 6 7 Contents of array B before swap: 8 9 10 11 12 13 14 Contents of array A after swap: 8 9 10 11 12 13 14 Contents of array B after swap: 1 2 3 4 5 6 7
A) Include a function to find the length of a vector stored in an array where the length of an N-dimensional vector L is: Length = sqrt L 0^2 + L 1^2 + L 2^ + L n-1^2
B) Form of function call: Result = Length(A, Size) B) Include a function to swap the contents of two equal size arrays named A and B. Form of function call: Swap(A, B, Size)
C) Include a function to reverse the contents of an array. For example, an array that
originally contained the elements 1,2,3,4 would contain 4,3,2,1 after the function call.
Form of function call: Reverse(A, Size)
This question has not been answered.
Create a free account to get help with this and any other question!
Brown University
1271 Tutors
California Institute of Technology
2131 Tutors
Carnegie Mellon University
982 Tutors
Columbia University
1256 Tutors
Dartmouth University
2113 Tutors
Emory University
2279 Tutors
Harvard University
599 Tutors
Massachusetts Institute of Technology
2319 Tutors
New York University
1645 Tutors
Notre Dam University
1911 Tutors
Oklahoma University
2122 Tutors
Pennsylvania State University
932 Tutors
Princeton University
1211 Tutors
Stanford University
983 Tutors
University of California
1282 Tutors
Oxford University
123 Tutors
Yale University
2325 Tutors