Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program that declares a 2D array called theRandoms. The array should ho

ID: 652321 • Letter: C

Question

Create a program that declares a 2D array called theRandoms. The array should hold ten rows with nine columns.

Write a function call FillArray that will fill a 2D array with variable rows and nine columns with random odd numbers from 1 to 99.

Create a function called CountOdds that will search a two dimensional array of various rows and nine columns for the number of occurrences a particular number is found within the array. The function should return the number of occurrences the number appears within the array *and* the coordinates, row and column, where each match is located.

Your CountOdd function, at the very least, should take as arguments the number to search for, and the two dimensional array to search. You are going also to need something to return the row and column coordinates of found matches. You could use one or two arrays but I'll leave that up to you.

Next, create another function called GetValueAt that will take as arguments a set of row and column coordinates and a 2D array of variable rows and nine columns. The function should use the row and column coordinates to return the value in the 2D array at the coordinates.

Write a function call PrintArray that will print a 2D array with any number of rows and nine columns

Finally write some kind of driver code in main to demonstrate the functionality of your program:

Declare theRandoms array

Call FillArray on theRandoms

Call CountOdds on theRandoms with an odd number between 1 and 99; get the number of matches, and coordinates of *every* match

Use the number of matches in a for loop with the row and column coordinates to call GetValue on the coordinates of every match to verify your coordinates are correct. Output the row, column and value returned from GetValue to verify you coordinates are correct. You may choose to put this code in a function called PrintCoordinates if you wish.

Call the PrintArray function with theRandoms to verify you found all the matches in theRandoms.

What not to do

Using any of the following will drop your grade for this assignment by 70%

global variables

cout in any function other than main, PrintArray and PrintCoordinates

goto statements

Explanation / Answer

#include using namespace std; int main() { int input, remainder, odd = 0, even = 0; int *myEvenData, *myOddData; myEvenData = new int [even]; myOddData = new int [odd]; cout > input; while (input != 0) { remainder = input % 2; if (remainder == 0) { myEvenData[even] = input; even++; } else { myOddData[odd] = input; odd++; } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote