Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. using ClassLibrary;
  3.  
  4.  
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         do
  10.         {
  11.             int M = GetInt("количество строк матрицы");
  12.             int N = GetInt("количество столбцов матрицы");
  13.             bool flag;
  14.                 flag = false;
  15.                 try
  16.                 {
  17.                     Circle[][] A = Methods.CreateMatrix(M, N);
  18.                     bool[][] F = Methods.GetAttributesMatrix(A);
  19.                     int[] B = Methods.TrueInRows(F);
  20.                     Methods.PrintAll(A, F, B);
  21.                 }
  22.                 catch (Exception ex)
  23.                 {
  24.                     flag = true;
  25.                     Console.WriteLine("\n"+ex.Message);
  26.                 }
  27.                 Console.WriteLine("\nДля выхода из программы нажмите  ESC...\nДля запуска сначала - любую клавишу....");
  28.             } while (Console.ReadKey().Key != ConsoleKey.Escape);
  29.         }
  30.        
  31.  
  32.     //метод для ввода с проверкой
  33.     public static int GetInt(string name)
  34.     {
  35.         int result;
  36.         Console.Write("Введите {0}: ", name);
  37.         while (!int.TryParse(Console.ReadLine(), out result))
  38.             Console.Write("Ошибка! Попробуйте ещё: ");
  39.         return result;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement