Question: using c++, please help. Task Description: You have been given a very simple program that performs basic operations addition, subtraction, editing) on two randomly generated

using c++, please help.
 using c++, please help. 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,

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. InitializeVestas: 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. EditVester: 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. Calculate Axerage: 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. paint. Vector: A void function that takes a vector as a parameter along with its size, and prints it on the screen a 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. File Edit Format View Help #include #include #include include using namespace std; int main() int vsiye- ; /variable for the size of the arrays, its the same for both so that we can do ition and subtraction int vid - //use it to determine which vector to operate on, used for average computation int ceiling - when generating randon numbers to place in vector, this constraints the axuber attable by the randon number generator int action; //determine which course of action the program will take double w- 0.0 GetSite: cout>action; 1/wyst(CLS): (en fairy true llection 1 Il action5) syste("CLS"); Couter Invasi input. Please enter Desired Action cin.clear); cingnore(10000, to GetAction 1 If(action-1) oto end action) for(int 1-; Istre, L.) result-21) cout eise f(action - 2) BetVector cout Average of Vector 1, or Vector 2 (Enten 1 or 2) ">V_Id Wein fall() -- true ll 10-16 Id-2) system("C: cout Invalid Input. Please enter Vector Selection (2) cin.clear(); cin ignore (18000); coto cetVector goto get Vector 17(v_id = 1) for(int 1-0; le size, 1.) ron sum vi[1] else if(v_id 2) for(int 1-6; iev_stre; i++) runs 2011: avg - (double) run_sum/(double)v_size; cout>index: 1f(cin.fail() -- true | indexc 1 Index(v_size: 1)) system("CLS"); cout>_id; if(cin.fail() - true II (v_id! -1 88 v_1d1-2)) system("CLS"); cout Get Index: cout(v_size-1)) { system("CLS"); cout>V1[Index]; for(int 1-; i<_size i cout else if cin>>V2[Index] for(int 1-0; i

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!