Question: c++ Given a 2d array that is a 4x4 array. I need a function that takes a 2d array. Then asks the user for a

c++

Given a 2d array that is a 4x4 array. I need a function that takes a 2d array. Then asks the user for a row and collumn. This is a sliding game where if I choose row 2 and collum 1. First it will check if it is zero. If it is zero repromt the user for another row and collumn. If the point is a one it will search for a zero that is above, below, left or right and swap with it. It will not swap diagonally. If a zero is no where to be found around the point repromt the user for a row and collumn.

*Please ask if you have questions *Try to not use built in functions and keep it simple for a newer programmer to understand.

int swap(int array) above is the function header example array: [[1,1,1,1], [1,0,1,1], [1,1,1,1], [1,1,1,1]]

user chooses 2 1

updated array [1,1,1,1], [0,1,1,1], [1,1,1,1], [1,1,1,1]]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets walk through the steps to create the function swap in C for the sliding puzzle game Well start by examining each part of the problem statement an... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!