Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The only things I need help with are in bold. I need a function howManyEven that would find the total number of even elements in
The only things I need help with are in bold. I need a function howManyEven that would find the total number of even elements in an array. And I need a function printArray, that prints the elements in the array with proper formatting. When writing these 2 functions please try to code these 2 functions so they will fit in the program easily. Thank you very much!
Program 1 Given that arrayIntValues [MAX_ROWS][MAX_COLUMNS) is a 2 dimensional array of positive integers, write a C++ function howManyEven to find the total number of even elements in the array. It should have input parameter array arrayIntValues. The function should return an integer. Also create a C++ function called printArray, with the input parameter array arrayIntValues, to print out the elements in the array (be sure to have row and column labels and proper formatting (i.e.s|column values line up). Main must be in one source file and all other functions in a second source file. The constants MAX_ROWS and MAX_COLUMNS must be accessed globally by defining the following global variables: or const int MAX_ROWS = 3; const int MAX COLUMNS = 2; #define MAX_ROWS 3 #define MAX_COLUMNS 2 or The array arrayIntValues is initialized by the following statement within main(): int arrayIntValues [MAX_ROWS][MAX_COLUMNS] = {{3, 2}, {4,5}, {2, 2} }; Print out the array and the count of positive even numbers (label appropriately) in function printArray. User enters a new set of values into the array (must do it at least once) as many times as they wish and runs printArray against the new array values each time. Be sure to validate input is positive integers. Validate user input ("y" or "n") when asking if the user wants to enter a new set of valuesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started