家庭作业问题...我的代码编译并且我可以输入数组并使用sentinel值退出,但是它没有正确地将数组传递给Statistics方法来执行操作。我错过了什么?我只是想要一些提示,而不是答案。
class IntegerFacts
{
static void Main()
{
int count, min, max, add;
double avge;
int[] listOfTen = new int[10];
FillArray(listOfTen);
Statistics(listOfTen, out count, out max, out min, out add, out avge);
WriteLine("The array has {0} values", count);
WriteLine("The highest value is {0}", max);
WriteLine("The lowest value is {0}", min);
WriteLine("The sum of the values is {0}", add);
WriteLine("The average is {0}", avge);
}
public static int[] FillArray(int[] array)
{
array = new int[10];
int counter = 0;
do
{
Write("Enter up to 10 numbers of any length, type 999 to stop > ");
string entryString = ReadLine();
if (entryString == "999")
{
return array;
}
else
{
array[counter] = Convert.ToInt32(entryString);
++counter;
}
} while (counter < 10);
return array;
}
public static void Statistics(int[] array, out int els, out int high, out int low, out int sum, out double avg)
{
els = array.Count();
high = array.Max();
low = array.Min();
sum = array.Sum();
avg = array.Average();
}
}