Question: C++ // main.cpp // #include #include #include using namespace std; static const long N = 100000; // TODO: your dot product function goes here! //
C++


// main.cpp
//
#include
#include
#include
using namespace std;
static const long N = 100000;
// TODO: your dot product function goes here!
// int dotProduct( ...
// {
// // ...
// }
int main()
{
// read in data set 1
ifstream data1("sample_vector_1.dat");
array
for (long i = 0; i
{
data1 >> v1[i];
}
data1.close();
// read in data set 2
ifstream data2("sample_vector_2.dat");
array
for (long i = 0; i
{
data2 >> v2[i];
}
data2.close();
// TODO: call your dot product function below and store the result in the variable dot
// long dot = dotProduct( ...
cout
}
inside of array objects, it is your job to compute the dot product of those two arrays. 2. Rules You must compute the dot-product within a new function (you will add this new function to main.cpp above the main function). Be mindful of the variable N within the program, use this when referring to the size of the array! o o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
