Question: C++ pls Write functions with the following headers: int* readVector(char fname[], int &size) This function should read values from the file and save them in
Write functions with the following headers: int* readVector(char fname[], int &size) This function should read values from the file and save them in a 1D array (vector) and return a pointer to it. The first element in the file is number of values followed by the values. Note that size is passed to the function by reference, so you have to define it in the caller. void print Vector(char fname[], int *M, int size) This function should print the content of the 1D array to the output filet. void VectorMult (int *A, int *B, int *R, int size) The function perform a scalar multiplication the vector with the vector and save the result in vector. (element by element multiplication) Test the function with a program that reads two files "input1.txt" and "input2.txt" and save the results in pointers A and B, call the VectorMult to calculate the vector R then finally print the result in the file "output.txt
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
