(c) Complete the following C++ function which receives a 9x9 integer array together with two integers which specify the starting row and column indices of a particular "region" (i.e. a 3x3 sub- array...


(c) Complete the following C++ function which receives a 9x9 integer array together with two<br>integers which specify the starting row and column indices of a particular

Extracted text: (c) Complete the following C++ function which receives a 9x9 integer array together with two integers which specify the starting row and column indices of a particular "region" (i.e. a 3x3 sub- array contained within the 9x9 array). For example, the top left region is identified with row = 0 and col = 0. The top middle region is identified with row = 0 and col = 3, and the top right region is identified with row = 0 and col = 6. The remaining 6 regions are identified in a similar fashion ( row = 3, col = 0, row =3, col = 3, row = 3, col = 6, etc. ) The function determines whether the specified region satisfies "Sudukoness" and returns a Boolean value accordingly: bool check_region (int a[][9] , int which_row, int which_col ) bool all_found - true; bool number_found ; for (int number - ; number <- number_found="" -="" for="" (int="" row="" -="" i="" row="" i="" row++)="" for="" (int="" col="" -="" i="" col="">< ;="" col++)="" {="" if="" (="" number="" --="" a[row="" +="" +="" which_col]="" )="" number_found="" -="" :="" we="" found="" the="" number,="" so="" stop="" searching="" for="" it="" }="" col="" loop="" if="" (="" number_found)="" {="" ;="" stop="" searching="" from="" the="" row="" as="" well="" row="" loop="" if="" all="" the="" numbers="" are="" found="" in="" the="" region="" _found="" will="" be="" true,="" otherwise="" it="" will="" set="" false="" all_found="" -="" if="" (="" false="" --="" number_found="" )="" {="" cout="">< "="" the="" missing="" number="" in="" this="" region="" -="" "="">< number="" ;="" }="" do="" this="" for="" all="" the="" numbers="" from="" 1="" to="" 9="">
(b) Complete the following C++ function (by filling in the blanks) which receives a pointer to an<br>integer as an argument along with an integer which specifies a column number. The function<br>determines whether the particular column satisifies the conditions for

Extracted text: (b) Complete the following C++ function (by filling in the blanks) which receives a pointer to an integer as an argument along with an integer which specifies a column number. The function determines whether the particular column satisifies the conditions for "Sudokuness" and returns a Boolcan value accordingly. The pointer argument is used by the function to access a particular element of the array using the two-dimensional array translation formula (instead of the stan- dard array (row] [col] index notation employed in part (a)). The pointer argument will con- tain the address of the first element of the 9x9 two-dimensional array whose specified column is to be checked to see if it satisfies "Sudokuness". bool check_col (int* a, int which_col) bool all_found - true; bool number_found ; for (int number - i number <- number_found="" -="" for="" (int="" row="" -0="" ;="" row="">< 9="" ;="" row++)="" if="" (="" number="" --="" {="" number_found="" -="" :="" we="" found="" the="" number,="" so="" stop="" searching="" for="" it="" if="" all="" the="" numbers="" are="" found="" in="" the="" col="" all_found="" will="" be="" true,="" otherwise="" it="" will="" be="" set="" to="" false="" all_found="" if="" (="" false="" --="" number_found="" )="" {="" cout="">< "the="" missing="" number="" in="" this="" col="" -="" -="">< number ; } // do this for all the numbers from 1 to 9 return number="" ;="" }="" do="" this="" for="" all="" the="" numbers="" from="" 1="" to="" 9="">
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here