For the C++ code provided , Add detailed documentation(explain the code and what
ID: 3697684 • Letter: F
Question
For the C++ code provided , Add detailed documentation(explain the code and what it's doing) line by line from line 11 - 56
For example , if you are explaining what's happening on line 13....
Type line 12 // (insert explanation) For the C++ code provided , Add detailed documentation(explain the code and what it's doing) line by line from line 11 - 56
For example , if you are explaining what's happening on line 13....
Type line 12 // (insert explanation) 1. //write a progras that 11lustrates how to use the functions 2. I/inner_product and partial sum 4. #include 5. #include algorithm» 6· "include 7. #include 8. #include 9. "include 18 11. using namespace std; 12 13. void print(vectorcint vList); 14. 15. int main) f 16. int list1[8] (1, 2, 3, 4, 5, 6, 7, 8) 17, int list2[8] (2, 4, 5, 7, -9, 11, 12, 14); 18 19. vectorint> veclist(1ist1, list1 + 8); 20. vectorcint> newvList(list2, list28); 21 22. int sum; 23 4 sUm inner_product (veclist.begin), veclist.end), newWList.begin), ) 26. 27. cout
Explanation / Answer
13// declarationg ofr the function print
15// writing the main
16// creating a list1 array containing 8 elements
17//creating a list2 array containing 8 elements
19// creating a vector called veclist having elements from list1.
20//creating a vector called newlist having elements from list2.
22// declare an integer variable sum
24//now we will calculate the inner product of veclist and newlist and store it in sum.
27//Ths will display the value of sum
30//it calculates the inner product of the 2 lists including + and - numbers
34//.This will display the product as sum.
37//calls the partial_sum function to find partial sum of the 2 lists
40//calls the printlist function to display the newlist wih partial sum
42// calls the partial_sum to find partial multiplication of 2 lists
47//calls print list to print new list that has been created above
52-56// this is used to print the new list by passing the list as parameter and this will display its elements.