Ok I have spent hours trying to debug, STFW and the forums, looked at my beginers book until finally I decided to give up and harass you guys with another array question. You see I am writing my first program outside of book exercises (a program that will solve sudoku puzzles) and very early on I have ran into a bit of a snag:
You see, when I enter the numbers 1-9 I get an output like thisCode:#include <iostream> int main(){ int sudoku[9][9]; int a, b; b=0; for(a = 0; a < 9; a++) { cout<< "insert a number 1-9 for the cell ["<<a+1<<"]["<<b+1<<"] "; cin>>sudoku[a][b]; } for(a = 0; a > -1 && a < 9; a++){ cout<< sudoku[a][b]; cin.get(); } return 0; }
12
3
4
5
6
7
8
9
Why is it that the 1 and 2 are bunched together and how do I fix it?



LinkBack URL
About LinkBacks


