Below is a program that does not compile because the functions readDoubles and dotProduct are not defined. Complete the program so that the program will compile and compute the dot product of these two vector files. Vector1.txt & Vector2.txt. In these files the first number is an integer, indicating how many floating point values the vector contains.
Assume the two vectors are of the same length, so you'll only have to pass one size variable to the dotProduct function. You'll remember from class 23, If v = [a1,a2,...,am] and w = [b1,b2,...,bm] are two vectors of dimension m the dot product of vector v and vector w is v1*w + v2*w2 + ... + vm*wm.
Do NOT modify main() – you should only add the function prototypes and definitions.
using namespace std;
//Prototypes for readDoubles and dotProduct goes here.
int size1, size2;
//read in the two vectors
double* v1 = readDoubles("hw25_vector1.txt", size1);
cout << "Read vector 1. Size is: " << size1 << endl;
double* v2 = readDoubles("hw25_vector2.txt", size2);
cout << "Read vector 2. Size is: " << size1 << endl;
//calculate dot product
double dp = dotProduct(v1, v2, size1);
//Output the result
cout << "The dot product of Vector1 and Vector2 is: " << dp << endl;
//Definitons for readDoubles and dotProduct goes here.
Turn in: a printout of your source code and a screen capture of your program running on the input files. For troubleshooting purposes the dot product of the two vectors provided is 45.2