Answer to Question #252668 in C++ for koi

Question #252668
Use the following array of 8 integers to answer the following questions, {2,3,2,1,2,5,8,2}
a) You are required to write a user defined C++ function that will receive the above array as a
parameter, and will loop through it and re-arrange it into the following final output
{5,3,1,8,2,2,2,2} and display it from the main function of your program. [5 Marks]
The idea is to position all values equal to 2 in the array to come after the other values not
equal to 2. The order of the other values i.e 5,1,3 and 8 does not matter as long as they appear
positioned before all 2s as illustrated in the hint below:
Initial array: {2,3,2,1,2,5,8,2}
NumbertoMove = 2
Final Array: {5,3,1,8,2,2,2,2}
b) Write another separate function in the same program above that takes the array above,
{2,3,2,1,2,5,8,2} as its parameter and loops through the elements calculating the sum
and product of all the elements and displays them.
1
Expert's answer
2021-10-17T09:52:11-0400
Dear koi, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS