Arrays: Variable indexes that define a set of specified numbers of the same type starting from 0
Int[] Name=new Int[n];
------------------------------------------------------
To automatically iterate through an array:
foreach (int a in Shu)
{
Console.WriteLine (a);
}
The above formula is equivalent to:
for (int i=0;i<shu.length;i++)
{
int A;
A=shu[i];
Console.WriteLine (a);
}
----------------------------------------
Equivalent substitution:
int a=3,b=5;
int C;
C=a;
A=b;
B=c;
Enter 8 numbers and sort from large to small (bubble sort)
Int[] A = new int[8];
for (int i = 0; i < 8; i++)
{
A[i] = Convert.ToInt32 (Console.ReadLine ());
}
for (int i= 0; i < 8; i + +)
{for (int j=i; J <8; J + +)
{
if (A[i] < a[j])
{
int Zhong;
Zhong = a[i];
A[i] = A[j];
A[J] = Zhong;
}
}
Console.WriteLine (A[i]);
}
Console.ReadLine ();
Arrays-auto-traverse arrays-bubble sort