Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- namespace Lab4Array_
- {
- internal class Program
- {
- public class ReverseComparer : IComparer
- {
- public int Compare(object x, object y)
- {
- return new CaseInsensitiveComparer().Compare(y, x);
- }
- }
- public static void Splitter(int[] A, int[] B, out int[] C)
- {
- C = new int[10];
- int i = 0, j = 0, k = 0;
- while (i < A.Length && j < B.Length)
- C[k++] = A[i] < B[j] ? A[i++] : B[j++];
- while (i < A.Length)
- C[k++] = A[i++];
- while (j < B.Length)
- C[k++] = B[j++];
- for (k = 0; k < C.Length; k++)
- Console.Write(C[k]);
- }
- private static void Main()
- {
- int[] arr1 = { 1, 2, 4, 5, 6 };
- int[] arr2 = { 3, 0, 7, 8, 9 };
- int[] array;
- Array.Sort(arr1);
- Array.Sort(arr2);
- Splitter(arr1, arr2, out array );
- IComparer revComparer = new ReverseComparer();
- Array.Sort(array, revComparer);
- Console.Write("\nОбратная сортировка: ");
- foreach (var t in array)
- Console.Write(t);
- Console.Write("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement