cpp implementation of Surrounded Regions

Please be attention the order of two-dimensional array subscripts are on the contrary of regular use of coordiantes