数组:一次性定义固定长度的一组数据;
数据类型[] 数组名 =new 数据类型[(个数)]
//输入n个人的分数,按分数从高到低排序
/* Console.WriteLine("输入人数:");
int n = int.Parse(Console.ReadLine());
int[] arr = new int[n];
for (int i = 0; i < n ; i++)
{
Console.Write("第"+(i+1)+"个人的成绩为:");
arr[i]=int.Parse (Console .ReadLine ());
}
for (int j = 0; j < arr.Length-1; j++)
{
for (int i = j + 1; i < arr.Length; i++)
{
if (arr[j] < arr[i])
{
int zhong = arr[i];
arr[i] = arr[j];
arr[j] = zhong;
}
}
}
for (int i = 0; i <arr. Length; i++)
{
Console.Write(arr[i]);
}
*/
/* Console.Write("输入人数:");
int n = int.Parse(Console .ReadLine ());
string []arr=new string [n];
for (int i = 0; i < n; i++)
{
Console.Write("第"+(i+1)+"个人的手机号为:");
arr[i]= Console .ReadLine ();
}
for (int i = 0; i < n; i++)
{
Console.Write(arr[i]);
Thread .Sleep(100);
Console.Clear();
}
Random r = new Random();
int index = r.Next(0,n);
Console.Write(arr[index ]);*/
/* int[] arr = new int[6];
for (int i = 0; i < 6; i++)
{
Random r = new Random();
arr[i] = r.Next(1,34);
for (int j = 0; j < i; j++)
{
if(arr[j]==arr[i])
{
i--;
break;
}
}
}
foreach (var a in arr)
{
Console.Write(a+" ");
}
Random b = new Random();
int c = b.Next(1, 17);
Console.WriteLine(c);
二维数组:多个一维数组就是二维数组;
Int [,]arr=new int[,]