cpp implementation of Spiral Matrix