Write another separate function in the same program above that takes the array above,{7,3,7,7,7,5,2,7} and loops through the elements calculating the sum and product of all the elements and displays them.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.4: Passing Addresses
Problem 3E
icon
Related questions
Question
Use the following array of 8 integers to answer the following questions,
{7,3,7,7,7,5,2,7}
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,2,7,7,7,7,7} and display it from
the main function of
your program.
The idea is to position all values equal to 7 in the array to come after the
other values not equal to 7. The order of the other values i.e 5, 3 and 2
does not matter as long as they appear positioned before all 7s as
illustrated in the hint below:
Transcribed Image Text:Use the following array of 8 integers to answer the following questions, {7,3,7,7,7,5,2,7} 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,2,7,7,7,7,7} and display it from the main function of your program. The idea is to position all values equal to 7 in the array to come after the other values not equal to 7. The order of the other values i.e 5, 3 and 2 does not matter as long as they appear positioned before all 7s as illustrated in the hint below:
does not matter as long as they appear positioned before all 7s as
illustrated in the hint below:
Initial array: {7,3,7,7,7,5,2,7}
NumbertoMove = 7
%3D
Final Array: {5,3,2,7,7,7,7,7}
b) Write another separate function in the same program above that takes the
array above,{7,3,7,7,7,5,2,7} and loops through the elements
calculating the sum and product of all the elements and displays them.
Transcribed Image Text:does not matter as long as they appear positioned before all 7s as illustrated in the hint below: Initial array: {7,3,7,7,7,5,2,7} NumbertoMove = 7 %3D Final Array: {5,3,2,7,7,7,7,7} b) Write another separate function in the same program above that takes the array above,{7,3,7,7,7,5,2,7} and loops through the elements calculating the sum and product of all the elements and displays them.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning