Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) (b) Declare two integer constants ROWSIZE equal to 4 and COLSIZE equal to 4. Declare two int two-dimensional arrays, namely play1 with ROWSIZE

 

(a) (b) Declare two integer constants ROWSIZE equal to 4 and COLSIZE equal to 4. Declare two int two-dimensional arrays, namely play1 with ROWSIZE number of rows and COLSIZE number of columns, and play2 with ROWSIZE number of rows and COLSIZE number of columns, (c) Assume that values have been assigned to all the elements of play1 and play2. Also assume that an int variable tricky has been declared and intialised to 0. Use nested for loops and write down the necessary C++ statements to do the following: Each row of play1 is 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 elements to the value of tricky. For example, if play1 and play2 are initialised as follows: 15 37 4 6 37 6 8 5 8 and 5 0 7 8 3 3 3 5 8 7 6 5 7 8 15 7 3 4 5 respectively, then the value of tricky will be: 5+11+3+7+11+8+12+8+11+10+9+5+7+11+5+5=128 Display the value of tricky.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

maincpp ANION MANDARDSEN28mam 1 include ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Stats Data And Models

Authors: Richard D. De Veaux, Paul D. Velleman, David E. Bock

4th Edition

321986490, 978-0321989970, 032198997X, 978-0321986498

More Books

Students also viewed these Accounting questions

Question

1.12 Describe the sociocultural perspective on abnormal behavior.

Answered: 1 week ago