My parameters are that the users input has to be from 1 to 9 and the same number can't be entered twice. How do i modify this code to make sure that the user did those things or an error message should appear that their input is invalid.
Ok not easy enough. First of all I'm pretty sure you don't need the temp spot I can just use square[i][j], but if I have it in the loop, it just tells the user the input is invalid and continues instead of going back to redo the previous input. How do I make that happen?
OK. Progress! I've decided to just use a 1d array instead of a 2d. This is a bit easier. I've been able to validate the input, but I don't know how to check to see if a number has already been inputted.
Here's what I have:
If you persist on the removal of the temp var idea, then...
You could store the input in the array, then iterate through the array and check for any match with current input. If positive, move back one element otherwise continue.
(would be a bit messy)