PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
const int ROWSIZE = 4;
const int COLSIZE = 4;
int play1[ROWSIZE][COLSIZE] = {{1,5,3,7},
{6,8,5,8},
{3,3,3,5},
{7,8,1,5}};
int play2[ROWSIZE][COLSIZE] = {{4,6,3,7},
{5,0,7,8},
{8,7,6,5},
{7,3,4,5}};
int tricky = 0;
for(int i=0;i<ROWSIZE;i++){
for(int j=0;j<COLSIZE;j++){
if(play1[i][j] == play2[i][j])
tricky+=play1[i][j];
else
tricky+=play1[i][j]+play2[i][j];
}
}
cout<<tricky<<endl;
return 0;
}
QUESTION 4 16 marks 4.1 4.2 Declare two integer constants ROWI ZE equal to 4 and...
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 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...
4.1 4.2 (4) (4) 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 play2with ROWSIZEnumber of rows and COLSIZEnumber of columns, 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...
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:...
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...
please answer in Java..all excercises. /** * YOUR NAME GOES HERE * 4/7/2017 */ public class Chapter9a_FillInTheCode { public static void main(String[] args) { String [][] geo = {{"MD", "NY", "NJ", "MA", "CA", "MI", "OR"}, {"Detroit", "Newark", "Boston", "Seattle"}}; // ------> exercise 9a1 // this code prints the element at row at index 1 and column at index 2 // your code goes here System.out.println("Done exercise 9a1.\n"); // ------> exercise 9a2 // this code prints all the states in the...
using matlab
Create the following matrix B. [18 17 16 15 14 13] 12 11 10 9 8 7 6 5 4 3 2 1 Use the matrix B to: (a) Create a six-element column vector named va that contains the elements of the second and fifth columns of B. (6) Create a seven-element column vector named vb that contains elements 3 through 6 of the third row of B and the elements of the second column of B. Create...