这是我目前生成一组20个随机数的代码:
int[] array_1 = new int[20];
Random rand = new Random();
for (int i = 0; i < array_1.Length; i++)
{
array_1[i] = rand.Next(10,100);
Console.Write("{0} ", array_1[i]);
}
答案 0 :(得分:1)
int highest = 0;
int highestIndex = 0;
for (int i = 0; i < array_1.Length; i++)
{
if (array_1[i] > highest)
{
highest = array_1[i];
highestIndex = i;
}
}