I have a console application that displays an array on the left, right, top or bottom of '0'
0, 7}, {9, 4, 8}, {2, 1, 5}}; Public Zero WriteData () {Console.SetCursorPosition (0, 4); For (int col = 0; col & lt; 3; col ++) {for (int row = 0; line & lt; 3; row ++) {Console.Write ("{0} \ t", myNos [Col, row]); } Console. Wrightite (); }} Public Zero Level 1 () {Console.Clear (); Console.setcorrespondence (0, 0); Console Type ("Score: {0}", score); Console.setcursorposition (30, 0); Console Write ("Move: {0}", moves); WriteData (); String Hill = "A"; While (move! = "E") {Console.SetCursorPosition (0, 8); Console Type (\ "enter your move [L, R, T, B, E]:"); Move = console.readline (); Move = move Above (); While (move == "L") {if (myNos [0, 0] == 0) {WriteData (); } And if (myNos [0, 1] == 0) {myNos [0, 1] = myNos [0, 0]; MyNos [0, 0] = 0; WriteData (); } And if (myNos [0, 2] == 0) {myNos [0, 2] = myNos [0, 1]; MyNos [0, 1] = 0; WriteData (); } Else {WriteData (); }}}}
Everything is working as I want, but the only problem is that after updating the array and re-appearing, the cursor does not go back where it reads Will input I've tried to use it:
console; Reset operation (0, 8); and:
console. Readkey (); But neither seems to work.
I thought something that could be the answer, I declared this step variable globally And then modify my WriteData () method and
Public Zero WriteData () {Console.SetCursorPosition (0, 4); For { colon; integer col = 0 3; col ++) {for (line of line = 0; line of + l; 3; line ++) {Console.Write ("{0} \ t" , MyNos [col, line]); } Console. Wrightite (); } // This modification was menu = "A"; }
No comments:
Post a Comment