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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started