Question: Write a C++ program (main function) which will allow a user to enter values for two arbitrary sized arrays v and w, then compute

Write a C++ program (main function) which will allow a user to enter values for two arbitrary sized arrays v and w, then compute their dot product. The dot product calculation itself should be accomplished by a C++ function you write called dot, which will compute. the dot product of two arrays of arbitrary size. Your main function should use the dot function as follows: cout < < "The dot product is " < < dot(v,w,n) < < endl; where n is the length of the arrays, read from the keyboard when the program runs. An example run of your program should look like: Enter size of the arrays: 4 Enter the 4 elements of v: 1 2 3 4 Enter the 4 elements of w: -4 3 2 -1 The dot product is 4
Step by Step Solution
3.31 Rating (151 Votes )
There are 3 Steps involved in it
include iostream include vector Function to compute the dot product of two arrays int dot... View full answer
Get step-by-step solutions from verified subject matter experts
