Below is the assignment question. the question wants me to use 2 arrays to make the program.
A dot product is scalar output that is produced by an algebraic operation applied to two
length vectors. In this activity, you are going to create a program that will construct two
arrays of equal length from a textfile and then compute the dot product between the two.
For additional reference, see
http://mathworld.wolfram.com/DotProduct.html
You need to create a le called dotProduct.cpp for you to test the functionality of
the behaviour you will implement. Finally a makele that you need to provide to compile
and run the program. You are not provided with any test input files and must create your
own as defined here. Be sure to upload it with the rest of your code. The input text file
you upload should be called inputs.txt.
When the program starts, you will prompt the user to enter a file name such as inputs.txt. This will be structured as follows:
1,2,3,4,5
1,2,3,4,5
It will contain two lines of data, comma separated and consist of integer numbers. The
length of the arrays you need to consider is set to 5. You will read both lines, each into
its own array. From there, you will compute the dot product of these two arrays as well
as display both arrays as they were contained in the text le. Pay close attention to the
use of space and avoid trailing spaces in your output.
If the input file looks like this:
1,3,-5
4,-2,-1
Then an example output is:
Please enter the name of the file: inputs.txt
Array 1: 1,3,-5
Array 2: 4,-2,-1
The dot product is: 3
You will have a maximum of 5 uploads for this activity.