using System using System Collections using System Linq using System T

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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);
}
}
}