Question: a a Task Description: You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors.

 a a Task Description: You have been given a very simple
program that performs basic operations (addition, subtraction, editing) on two randomly generated
integer vectors. All functionality has been included in main, causing code segments
to be repeated as well as diminishing the readability: Rewrite the program
by grouping calculations and related operations into functions. In particular, your program

a a Task Description: You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability: Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions. InitializeVesters: This is a void function that initializes the two vectors by random numbers. Inside this function, the user will be prompted to enter the maximum random number. After the vectors have been populated with random numbers, print the vectors side by side. The parameters are the two arrays and their size. EditVector: This is a void function that allows the user to update a value belonging to either vector. The user specifies the vector he wants to edit the index he wants edit, and finally the updated value. The entire vector must then be printed on the screen. You need to pass the two arrays and their sizes. CalculatsAretags: This is a function that returns the average value in a vector. It returns a double and receives as parameters an array and its size. print Viestor. A void function that takes a vector as a parameter along with its size, and prints it on the screen As you introduce each function, replace the code in main by the appropriate function call. Also, keep in mind that for some functions, any changes that occur within the function body must also be visible in main. Finally, some functions can be called within other functions. #include include using namespace std; int main() int v_size = 0; // Variable for the site of the arrays, its the same for both so that we can do addition and subtraction int v id- use it to determine which vector to operate on, used for average computation Int ceiling -0, When generating randon numbers to place in vector, this constraints the maximum number attainable by the randon number generator int action - 0; //determine which course of action the program will take double av -0.8; GetSize: cout

ekse if(action - 1) for(int 1-0; i If id-1) for(int - for(int i=0; i>v_id; if(cin, fail) -- true 1 (v_idl-1 && v_id!-2)) { system("CLS"); cout>index; if(cin.failo -- true || indexeo || index(v_size-1)) { system("CLS"); cout>V1[index]; for(int 1-8; v_size; 1++) cout>2[index]; for(int 1-3; 1 v_size; i--) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!