using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { internal interface leftSort { void result(int a); } internal interface rightSort { void result(int a); myClass4 push(myClass4 a); } class myClass4: leftSort, rightSort { private int[] m; public myClass4 (int[] x) { this.m = new int[x.Length]; this.m = x; } myClass4 rightSort.push(myClass4 a) { int[] tek = new int[m.Length + a.m.Length]; //tek = m; for (int i = m.Length; i < m.Length + a.m.Length; i++) { tek[i] = a.m[i - m.Length]; } myClass4 ans = new myClass4(tek); return ans; } void leftSort.result(int n) { for (int i = 0; i < n; i++) { int mini = i; for (int j = i; j < n; j++) { if (this.m[j] < this.m[mini]) { mini = j; } } int qwe = this.m[i]; this.m[i] = this.m[mini]; this.m[mini] = qwe; } } void rightSort.result(int n) { for (int i = this.m.Length - n; i < this.m.Length; i++) { int mini = i; for (int j = i; j < this.m.Length; j++) { if (this.m[j] < this.m[mini]) { mini = j; } } int qwe = this.m[i]; this.m[i] = this.m[mini]; this.m[mini] = qwe; } } } class Program { static void Main(string[] args) { int[] a = new int[8] { 1, 34, 2, 3, 45, 2, 3, 6 }; leftSort qwe = new myClass4(a); qwe.result(4); rightSort qwe1 = new myClass4(a); rightSort qwe2 = new myClass4(a); myClass4 qwe3 = new myClass4(a); qwe2.push(qwe3); qwe1.result(4); int rty; } } }