Hi,everyone.
The problem is when I input "m" or "p" or other single input, it gives "ArgumentOutOfRangeException" in the line "int i = Int32.Parse(command.Substring(1, 1));". "if(command.Substring(0, 1) == "r" && i<= numCols)" these kind of condition use when the input like "r1,r2,r3...", then the following method takes number part as parameter to execute codes since i converted them already.
I was trying to set up length condition(command.Lenght>2) before "int i" part, but that does not work as then "i" can not be taken as an parameter into those methods. How can I fix this???
Any suggestion would be great!!! Thanks!!!
Console.Write("Enter command =>");
string command = Console.ReadLine();
int i = Int32.Parse(command.Substring(1, 1));
if(command == "m") menu();
else if (command == "p") PrintPuzzle();
else if (command.Substring(0, 1) == "n") shuffle(i);
else if (command.Substring(0, 1) == "r" && i<= numCols) moveRowRight(i);
else if (command.Substring(0, 1) == "c" && i <= numRows) moveColDown(i);
else if (command.Substring(0, 1) == "x")
System.Environment.Exit(0);
else
Console.WriteLine("Invalid command entered.");