Question: Write a C++ program that prints out the sum of all even numbers and odd numbers for a given array using pass by reference .

Write a C++ program that prints out the sum of all even numbers and odd numbers for a given array using pass by reference.

*Please try to implement the answer into the code in the attached picture or something similar so that I can better understand.* Write a C++ program that prints out the sum of all even

This is what I have so far, the program prints the even and odd numbers how I want it to but I don't know how to get them to print using pass by reference: numbers and odd numbers for a given array using pass by reference.

#include 4 using namespace std; 6 const int ARRAY_SIZE-10; 7 void addition(int myList[], int arraySize, int& myEvenSum, int& myOddSum); 8 9 int main) 10 int list [ARRAY_SIZE]-1,21,3,42,5,6,7,8,9,10; 12 //print out the sum of all even numbers and odd numbers for a given array //your code here 14 15 16 cin.get() 18 19 20 void addition(int myList[], int arraySize, int& myEvenSum, int& myOddSum) 21 for(int i-e;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!