Question: #include using namespace std; const int ARRAY _ SIZE = 5 ; int rand _ number ( ) { return rand ( ) % 4
#include
using namespace std;
const int ARRAYSIZE ;
int randnumber
return rand;
void populaterandnumbersint matrixARRAYSIZE
for int i ; i ARRAYSIZE; i
for int j ; j ARRAYSIZE; j
matrixij randnumber;
void printrandnumbersint matrixARRAYSIZE
for int i ; i ARRAYSIZE; i
for int j ; j ARRAYSIZE; j
cout matrixij;
cout endl;
int sumoddrowint row
int sum ;
for int i ; i ARRAYSIZE; i
if rowi
sum rowi;
return sum;
void promptsumoddrowint matrixARRAYSIZE
for int i ; i ARRAYSIZE; i
cout "Sum all odd numbers in row i sumoddrowmatrixi endl;
int main
srandtime;
int matrixARRAYSIZEARRAYSIZE;
populaterandnumbersmatrix;
cout "Random Numbers in the by Array:" endl;
printrandnumbersmatrix;
cout endl;
promptsumoddrowmatrix;
return ;
Learning outcome: assess students ability to:
Create a D array in a program.
Access data in a D array.
Define functions with the application of D array.
Generate and use random numbers.
Activity description: sum of all ODD numbers of the value in each ROW of a by matrix D array
Create a program that will sum all ODD numbers in each ROW of a dimension array. The program will:
Set the size of an array as a global constant variable with value of
define function randnumber Function randnumber is used to randomly generate a value between and and return the value as an integer.
Define function populaterandnumbers Function populaterandnumbers is used to populate the by matrix. It means that each cell of the rows and columns will be populated with one random number. This random number is obtained by using function randnumber
define function printrandnumber Function printrandnumber is used to print the value in each cell of the by array.
define function sumoddrow Function sumoddrow is used to sum all ODD numbers of the values in each ROW of a by array.
Define function promptsumoddrow The function is used to print the result of the sums as:
Sum all odd numbers in row
Sum all odd numbers in row
Sum all odd numbers in row solve thius c programthis
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
