Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Teams
- {
- public double points;
- }
- class Teams1 : Teams
- {
- public string name;
- public Teams1(string name, double points)
- {
- this.points = points;
- this.name = name;
- }
- }
- class Program
- {
- static void Up(Teams1[] x)
- {
- for (int i = 0; i < x.Length - 1; i++)
- {
- double xmax = x[i].points;
- int imax = i;
- for (int j = i + 1; j < x.Length; j++)
- {
- if (x[j].points > xmax)
- {
- xmax = x[j].points;
- imax = j;
- }
- }
- Teams1 temp;
- temp = x[imax];
- x[imax] = x[i];
- x[i] = temp;
- }
- }
- static void Main(string[] args)
- {
- Teams1[] group1 = new Teams1[4];
- group1[0] = new Teams1("Atletico", 37);
- group1[1] = new Teams1("Real", 29);
- group1[2] = new Teams1("Barcelona", 41);
- group1[3] = new Teams1("CSKA", 34);
- Teams1[] group2 = new Teams1[4];
- group2[0] = new Teams1("Spartak", 35);
- group2[1] = new Teams1("Zenit", 29);
- group2[2] = new Teams1("Arsenal", 33);
- group2[3] = new Teams1("Akhmat", 27);
- Up(group1);
- Up(group2);
- Teams1[] mainGroup = new Teams1[(group1.Length + group2.Length) / 2];
- for (int i = 0; i < mainGroup.Length; i += 2)
- {
- mainGroup[i] = group1[i / 2];
- mainGroup[i + 1] = group2[i / 2];
- }
- for (int i = 0; i < 4; i++)
- WriteLine(mainGroup[i].name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement