示例#1
0
 private static int[,] IntMatrixConsole()
 {
     while (true)
     {
         try
         {
             Console.WriteLine("введите матрицу");
             StringBuilder sb   = new StringBuilder();
             string        line = "";
             do
             {
                 line = Console.ReadLine();
                 sb.AppendLine(line);
             } while (line != "");
             int[,] Matrix = MatrixConvert.StringToIntMatrix(sb.ToString());
             if (Matrix.GetLength(0) != Matrix.GetLength(1))
             {
                 throw new Exception("матрица не квадратная");
             }
             return(Matrix);
         }
         catch (Exception eror)
         {
             Console.WriteLine(eror.Message);
         }
     }
 }
示例#2
0
文件: Program.cs 项目: InFly1/Attest2
 private static bool[,] BoolMatrixConsole()
 {
     while (true)
     {
         try
         {
             Console.WriteLine("введите матрицу");
             StringBuilder sb   = new StringBuilder();
             string        line = "";
             do
             {
                 line = Console.ReadLine();
                 sb.AppendLine(line);
             } while (line != "");
             bool[,] Matrix = MatrixConvert.StringToBoolMatrix(sb.ToString());
             return(Matrix);
         }
         catch (Exception eror)
         {
             Console.WriteLine(eror.Message);
         }
     }
 }