static void InputMenu() { char r; int w = 0, h = 0; do { Console.MainTitleText = "INPUT MENU"; Console.PromptText = "PLEASE ENTER YOUR CHOICE."; Console.MenuOptions = Menu.INPUT_MENU; Console.DisplayMode = SuperConsole.DISP_MENU; r = Console.UpdateGetChar(); switch (r) { case 'Q': do { Console.SetAlert("New Matrix", "Matrix row size", 3); h = Console.UpdateGetInt(); if (h == 0) { Console.SetAlert("ERROR", "Matrix rows must be at least 1.", 2); Console.UpdateGetChar(); } }while (h == 0); do { Console.SetAlert("New Matrix", "Matrix column size", 3); w = Console.UpdateGetInt(); if (w == 0) { Console.SetAlert("ERROR", "Matrix columns must be at least 1.", 2); Console.UpdateGetChar(); } }while (w == 0); if (w == h) { Console.SetAlert("CREATE MATRIX A", "Do you want to make Matrix A\nan identity matrix?", 1, Menu.OPT_YESNO); r = Console.UpdateGetChar(); } if (r == 'Y' && w == h) { MA = new Matrix(h, w, true); } else { MA = new Matrix(h, w, false); } Console.SetAlert("SUCCESS", "Matrix A was successfuly created.", 0); Console.UpdateGetChar(); break; case 'W': do { Console.SetAlert("New Matrix", "Matrix row size", 3); h = Console.UpdateGetInt(); if (h == 0) { Console.SetAlert("ERROR", "Matrix rows must be at least 1.", 2); Console.UpdateGetChar(); } }while (h == 0); do { Console.SetAlert("New Matrix", "Matrix column size", 3); w = Console.UpdateGetInt(); if (w == 0) { Console.SetAlert("ERROR", "Matrix columns must be at least 1.", 2); Console.UpdateGetChar(); } }while (w == 0); if (w == h) { Console.SetAlert("CREATE MATRIX A", "Do you want to make Matrix B\nan identity matrix?", 1, Menu.OPT_YESNO); r = Console.UpdateGetChar(); } if (r == 'Y' && w == h) { MB = new Matrix(h, w, true); } else { MB = new Matrix(h, w, false); } Console.SetAlert("SUCCESS", "Matrix B was successfuly created.", 0); Console.UpdateGetChar(); break; case 'A': if (MA == null) { Console.SetAlert("ERROR", "Matrix A not yet initialized!", 2); Console.UpdateGetChar(); } else { Console.MainTitleText = "EDIT MATRIX A"; Console.DisplayMatrix = MA; Console.DisplayMode = SuperConsole.DISP_MATRIX; string inp; for (int y = 0; y < MA.MatrixHeight; y++) { for (int x = 0; x < MA.MatrixWidth; x++) { Console.PromptText = "ENTER VALUE FOR [" + (y + 1) + ", " + (x + 1) + "] (X TO EXIT)"; Console.MatrixColumnHighlight = x; Console.MatrixRowHighlight = y; inp = Console.UpdateGetString(); if (inp.ToUpper() == "X") { y = MA.MatrixHeight; x = MA.MatrixWidth; } else { MA.SetCell(y, x, Convert.ToDouble(inp)); } } } Console.SetAlert("SUCCESS", "Matrix A successfuly edited.", 0); Console.UpdateGetChar(); Console.MatrixRowHighlight = -1; Console.MatrixColumnHighlight = -1; } break; case 'S': if (MB == null) { Console.SetAlert("ERROR", "Matrix B not yet initialized!", 2); Console.UpdateGetChar(); } else { Console.MainTitleText = "EDIT MATRIX B"; Console.DisplayMatrix = MB; Console.DisplayMode = SuperConsole.DISP_MATRIX; string inp; for (int y = 0; y < MB.MatrixHeight; y++) { for (int x = 0; x < MB.MatrixWidth; x++) { Console.PromptText = "ENTER VALUE FOR [" + (y + 1) + ", " + (x + 1) + "] (X TO EXIT)"; Console.MatrixColumnHighlight = x; Console.MatrixRowHighlight = y; inp = Console.UpdateGetString(); if (inp.ToUpper() == "X") { y = MA.MatrixHeight; x = MA.MatrixWidth; } else { MB.SetCell(y, x, Convert.ToDouble(inp)); } } } Console.SetAlert("SUCCESS", "Matrix B successfuly edited.", 0); Console.UpdateGetChar(); Console.MatrixRowHighlight = -1; Console.MatrixColumnHighlight = -1; } break; case 'D': if (MA == null) { Console.SetAlert("ERROR", "Matrix A not yet initialized!", 2); Console.UpdateGetChar(); } else { Console.MainTitleText = "EDIT MATRIX A CELL"; Console.DisplayMatrix = MA; Console.DisplayMode = SuperConsole.DISP_MATRIX; do { Console.PromptText = "ENTER ROW TO EDIT"; h = Console.UpdateGetInt() - 1; if (h >= MA.MatrixHeight || h < 0) { Console.SetAlert("ERROR", "Invalid row index!", 2); Console.UpdateGetChar(); } }while (h >= MA.MatrixHeight || h < 0); Console.MatrixRowHighlight = h; do { Console.PromptText = "ENTER COLUMN TO EDIT"; w = Console.UpdateGetInt() - 1; if (w >= MA.MatrixWidth || w < 0) { Console.SetAlert("ERROR", "Invalid column index!", 2); Console.UpdateGetChar(); } }while (w >= MA.MatrixWidth || w < 0); Console.MatrixColumnHighlight = w; Console.PromptText = "ENTER NEW VALUE FOR [" + (h + 1) + ", " + (w + 1) + "]"; MA.SetCell(h, w, Console.UpdateGetDouble()); Console.SetAlert("SUCCESS", "Matrix A's cell [" + (h + 1) + ", " + (w + 1) + "]" + "\nsuccessfuly edited.", 0); Console.UpdateGetChar(); Console.MatrixRowHighlight = -1; Console.MatrixColumnHighlight = -1; } break; case 'F': if (MB == null) { Console.SetAlert("ERROR", "Matrix B not yet initialized!", 2); Console.UpdateGetChar(); } else { Console.MainTitleText = "EDIT MATRIX B CELL"; Console.DisplayMatrix = MB; Console.DisplayMode = SuperConsole.DISP_MATRIX; do { Console.PromptText = "ENTER ROW TO EDIT"; h = Console.UpdateGetInt() - 1; if (h >= MA.MatrixHeight || h < 0) { Console.SetAlert("ERROR", "Invalid row index!", 2); Console.UpdateGetChar(); } }while (h >= MA.MatrixHeight || h < 0); Console.MatrixRowHighlight = h; do { Console.PromptText = "ENTER COLUMN TO EDIT"; w = Console.UpdateGetInt() - 1; if (w >= MA.MatrixWidth || w < 0) { Console.SetAlert("ERROR", "Invalid column index!", 2); Console.UpdateGetChar(); } }while (w >= MA.MatrixWidth || w < 0); Console.MatrixColumnHighlight = w; Console.PromptText = "ENTER NEW VALUE FOR [" + (h + 1) + ", " + (w + 1) + "]"; MB.SetCell(h, w, Console.UpdateGetDouble()); Console.SetAlert("SUCCESS", "Matrix B's cell [" + (h + 1) + ", " + (w + 1) + "]" + "\nsuccessfuly edited.", 0); Console.UpdateGetChar(); Console.MatrixRowHighlight = -1; Console.MatrixColumnHighlight = -1; } break; case 'X': r = 'X'; break; default: Console.SetAlert("ERROR", "Invalid selection", 2); Console.UpdateGetChar(); break; } }while (r != 'X'); }