13. Write function createBoard to do the following a. Return type void b. Parameter list includes i. Two-dimensional arr
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
13. Write function createBoard to do the following a. Return type void b. Parameter list includes i. Two-dimensional arr
13. Write function createBoard to do the following a. Returntype void b. Parameter list includes i. Two-dimensional array (i.e.dice), data type character, size: 16 rows, 6 columns (i.e. use theconstants) ii. Two-dimensional array (i.e. board), data typecharacter, size: 4 rows, 4 columns (i.e. use the constants) iii.One-dimensional array (i.e. usedDie), data type integer, size: 16columns c. Declare the following local variables i. Data typecharacter (i.e. letter) ii. Data type integer, (i.e. row) iii. Datatype integer, (i.e. col) iv. Data type integer (i.e. die) d. Writea loop to loop through the 4 rows (i.e. use the 5 constants) of theboard array i. Initialize variable col to 0 1. While variable colis less than 4 (i.e. use the constants) a. Set variable die equalto randomly selecting a value from 0 – 15 (i.e. use the constants)b. If the die has not been used (i.e. check the usedDie array atthe location) i. Set variable letter equal to function callgetLetter, passing as arguments 1. 2d array dice 2. Local variabledie ii. Set array parameter board, at the current row/col location,equal to the value stored in variable letter iii. Set arrayparameter usedDie, at the current die location, equal to 1 (i.e.use the constants) iv. Increment the loop control variable