Ans --> The required c++ instructions are as follows .In order to check the correctness of my code i have implemented the main functions but as you asked only instructions not whole code or function so i will send only that but will also provide you with the screenshot of code and output:
const int ROWSIZE=4;
const int COLSIZE=4;
int i,j;
int
play1[ROWSIZE][COLSIZE]={{1,5,3,7},{6,8,5,8},{3,3,3,5},{7,8,1,5}};//initialzing
matrix according to given values
int
play2[ROWSIZE][COLSIZE]={{4,6,3,7},{5,0,7,8},{8,7,6,5},{7,3,4,5}};//initialzing
second matrix
int trick=0;
for(i=0;i<ROWSIZE;i++)
{
for(j=0;j<COLSIZE;j++)
{
if(play1[i][j]==play2[i][j])//checking if elements are equal
trick=trick+play1[i][j];
else
trick=trick+(play1[i][j]+play2[i][j]);
}
}
cout<<" value of trick is "<<trick;
Screenshot of code is:
4.1 4.2 (4) (4) Declare two integer constants ROWSIZE equal to 4 and COLSIZEequal to 4....
QUESTION 4 16 marks 4.1 4.2 Declare two integer constants ROWSIZE equal to 4 and COLSIZEequal to 4. Declare two inttwo-dimensional arrays, namely playlwith ROWSIZEnumber of rows and COLSIZEnumber of columns, and play with ROWSIZEnumber of rows and COLSIZEnumber of columns, (4) (4) 4.3 Assume that values have been assigned to all the elements of playland play. Also assume that an int variable trickyhas been declared and intialised to 0. Use nested forloops and write down the necessary C++ statements...
QUESTION 4 16 marks 4.1 4.2 (4) (4) Declare two integer constants RONGI ZE equal to 4 and Ca.SI ZEequal to 4. Declare two i nt two-dimensional arrays, namely playlwith ROWI ZEnumber of rows and COLSI ZEnumber of columns, and play2with RONGI ZEnumber of rows and COLSI ZEnumber of columns, 4.3 Assume that values have been assigned to all the elements of pl ayland play 2. Also assume that ani nt variable trickyhas been declared and intialised to 0. Use...
QUESTION 4 16 marks 4.1 4.2 (4) (4) Declare two integer constants RONGI ZE equal to 4 and Ca.SI ZEequal to 4. Declare two i nt two-dimensional arrays, namely playlwith ROWI ZEnumber of rows and COLSI ZEnumber of columns, and play2with RONGI ZEnumber of rows and COLSI ZEnumber of columns, 4.3 Assume that values have been assigned to all the elements of pl ayland play 2. Also assume that ani nt variable trickyhas been declared and intialised to 0. Use...
QUESTION 4 16 marks 4.1 4.2 Declare two integer constants ROWI ZE equal to 4 and CO.SI ZEequal to 4. (4) Declare two i nt two-dimensional arrays, namely (4) playlwith ROMSI ZEnumber of rows and COL SI ZE number of columns, and pl ay2 with ROMI ZEnumber of rows and COL SI ZEnumber of columns, 4.3 Assume that values have been assigned to all the elements of pl ayland play. Also assume that ani nt variable tricky has been declared...
4.3 Assume that values have been assigned to all the elements of playland play2. Also assume that an int variable trickyhas been declared and intialised to 0. Use nested forloops and write down the necessary C++ statements to do the following: Each row of playlis compared element by element to the corresponding row of play2. If the elements are equal, add the value of one element to tricky. If the elements are not equal, add the sum of the two...
QUESTION 4 16 marks 4.1 Declare two integer constants ROWSIZE equal to 4 and COLSIZEequal to 4. (4) 4.2 Declare two inttwo‐dimensional arrays, namely play1with ROWSIZEnumber of rows and COLSIZEnumber of columns, and play2with ROWSIZEnumber of rows and COLSIZEnumber of columns 4.3 Assume that values have been assigned to all the elements of play1and play2. Also assume that an int variable trickyhas been declared and intialised to 0. Use nested forloops and write down the necessary C++ statements to do the following:...
4.1 Declare two integer constants ROWSIZE equal to 4 and COLSIZEequal to 4.
Write a Java program that does the following. a. Declare an integer 2D array with 5 rows and 5 columns. b. Initialize the array's elements to random integers between 1 and 10 (inclusive). c. Display all the elements in the 2D array as a table of rows and columns. d. Display the row index and column index of all the even integers in the 2D array. e. Display the sum of first row's elements.
Write a program that reads a matrix from the keyboard and displays the summations of all its rows on the screen. The size of matrix (i.e. the number of rows and columns) as well as its elements are read from the keyboard. A sample execution of this program is illustrated below: Enter the number of rows of the matrix: 3 Enter the number of columns of the matrix: 4 Enter the element at row 1 and chd umn 1: 1...
Question 1 a. Define the following matrices in a script file (M-file), ? = ( 8 9 10 11; 23 9 16 15 ;11 12 3 6; 1 2 8 9 ) ? = ( 2 21 7 15; 12 4 8 22; 23 9 5 13; 23 4 21 22) ℎ = (4 9 12 15) b. Add suitable lines of codes to the M-file to do the following. Each of the following points should be coded in only...