Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- try
- {
- int[][] MyArray;
- Console.Write("Введите количество строк: ");
- int n = int.Parse(Console.ReadLine());
- MyArray = new int[n][];
- MakeArray(MyArray);
- PrintArray("исходный массив:", MyArray);
- for (int i = 0; i < MyArray.Length; i++) Array.Sort(MyArray[i]);
- PrintArray("измененный массив", MyArray);
- }
- catch (FormatException)
- {
- Console.WriteLine("неверный формат ввода данных");
- }
- catch (OverflowException)
- {
- Console.WriteLine("переполнение");
- }
- catch (OutOfMemoryException)
- {
- Console.WriteLine("недостаточно памяти для создания нового объекта");
- }
- }
- static void MakeArray(int[][] mas)
- {
- for (int i = 0; i < mas.Length; ++i)
- {
- mas[i] = new int[i + 1 * 2];
- for (int j = 0; j < mas[i].Length; j++)
- mas[i][j] = i + j + 1;
- }
- }
- static void PrintArray(string a, int[][] mas)
- {
- Console.WriteLine(a);
- Console.WriteLine("0");
- for (int i = 0; i < mas.Length; i++)
- {
- for (int j = 0; j < mas[i].Length; j++) Console.Write("{0} ", mas[i][j]);
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement