using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace Garaev_r_r
{
class Class1: IComparer
{
//public interface IComparer(Object a, Object b)
//{
//}
int s;
int a;
public Class1(int s, int a)
{
this.s = s;
this.a = a;
}
public override string ToString()
{
return String.Format("{0} {1}", s, a);
}
}
class Program
{
static void Main(string[] args)
{
Array myArr = Array.CreateInstance(typeof(Int32), 3);
foreach (int i in myArr)
{
Console.Write("\t{0}",i);
}
Console.WriteLine();
myArr.SetValue(1, 1);
foreach (int i in myArr)
{
Console.Write("\t{0}", i);
}
Console.WriteLine();
/*myArr[1] = 8;
foreach (int i in myArr)
{
Console.Write("\t{0}", i);
}*/
int[] myArr1 = new int[3] { 11, 12, 13 };
myArr1[1] = 99;
foreach (int i in myArr1)
{
Console.Write("\t{0}", i);
}
Console.WriteLine();
int[] myArr2 = new int[3] { 11, 12, 13 };
myArr2.SetValue(88, 1);
foreach (int i in myArr2)
{
Console.Write("\t{0}", i);
}
Console.WriteLine();
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
myAL[1] = "?????????????";
foreach (Object obj in myAL)
{
Console.Write(" {0}", obj);
}
Console.WriteLine();
Class1[] g = new Class1[3];
g[0] = new Class1(1, 4);
g[1] = new Class1(2, 8);
g[2] = new Class1(5, 4);
foreach (Class1 i in g)
Console.WriteLine(i);
ArrayList a = new ArrayList();
a.Add(new Class1(2, 4));
a.Add(new Class1(4, 17));
a.Add(new Class1(3, 8));
for (int i = 0; i < a.Count; i++)
{
Console.WriteLine("{0:d}", a[i]);
}
Console.WriteLine();
Console.WriteLine();
int n = 3;
int[,] mas = new int[n, n];
for (int i = 1; i < n+1; i++)
for (int j = 1; j < n + 1; j++)
{
mas[i - 1, j - 1] = i * j;
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
Console.Write(" {0}", mas[i, j]);
Console.WriteLine();
}
int max = mas[0, 0];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (mas[i, j] > max)
max = mas[i, j];
Console.WriteLine("MAXIMALNOE");
Console.WriteLine(max);
}
}
}