Hello please help me to complete this C programming challeng
Hello, please help me to complete this C++ programming challenge. For preprocessor directive (#include), the program can use only iostream, iomanip, cmath, math, and string.
Program Objective
Write a program that asks the user to enter two vectors and then calculates and displays the dot product of the two vectors.
Background
The dot product of the two vectors (a1, a2, a3, ... , an) and (b1, b2, b3, ... , bn) is calculated as:
(a1, a2, a3, ... , an)*(b1, b2, b3, ... , bn) = (a1*b1 + a2*b2 + a3*b3, ... , an*bn)
*Note that the two vectors must have the same dimension (length)n in order to calculate their cross product.
Program Specifications
You program must:
Ask the user to enter the dimension (i.e. length) of the vectors.
Read the components of each vector into two separate arrays (one array for the first vector and a second array for the second vector).
Use a for loop to read in the components of the first vector.
Use another for loop to read in the components of the second vector.
Use yet another for loop to calculate the dot product.
Display the dot product of the two vectors.
You may assume that the largest vector dimension that the user will enter is 10.
**NOTE: The starter code contains five cout statements. You MUST use these five cout statements exactly as they are given. Do NOT modify these statements. Write the rest of the code and insert these five cout statements into your code in the appropriate locations. Do NOT add additional cout statements.
Starter code:
cout << \"This program calculates the dot product of two vectors.\" << endl;
cout << \"Enter the dimension (length) of the two vectors: \";
cout << \"Enter the \" << dimension << \" components of the first vector separated by spaces. \" << endl;
cout << \"Enter the \" << dimension << \" components of the second vector separated by spaces. \" << endl;
cout << \"The dot product of the two vectors is \" << dot_product << endl;
***Before you give your program, make sure you test your program with a variety of different vectors of various dimensions.
The following are two examples of correct execution of the program:
This program calculates the dot product of two vectors.
Enter the dimension (length) of the two vectors: 3
Enter the 3 components of the first vector separated by spaces.
1 -2 3
Enter the 3 components of the second vector separated by spaces.
4 5 -1
The dot product of the two vectors is -9
or
This program calculates the dot product of two vectors.
Enter the dimension (length) of the two vectors: 4
Enter the 4 components of the first vector separated by spaces.
7.4 2.1 3 -5.6
Enter the 4 components of the second vector separated by spaces.
-1.0 -3.55 5.02 -6.9
The dot product of the two vectors is 38.845
Solution
// Please let me know if any further clarification is required.
#include<iostream.h>
#include<conio.h>
void main()
{
float vect_one[10];
float vect_two[10];
float dot_product=0;
int dimension;
cout << \"This program calculates the dot product of two vectors.\" << endl;
cout << \"Enter the dimension (length) of the two vectors: \";
cin>>dimension;
cout << \"Enter the \" << dimension << \" components of the first vector separated by spaces. \" << endl;
for(int i=0;i<dimension;i++)
{
cin>>vect_one[i];
}
cout << \"Enter the \" << dimension << \" components of the second vector separated by spaces. \" << endl;
for(i=0;i<dimension;i++)
{
cin>>vect_two[i];
}
for(i=0;i<dimension;i++)
{
dot_product=dot_product+vect_one[i]*vect_two[i];
}
cout << \"The dot product of the two vectors is \" << dot_product << endl;
getch();
}
// Please rate this answer so that i can improve my quality of answer.

