Console.Write ("Please enter the number of judges:");//Enter the number of people
int Renshu = Convert.ToInt32 (Console.ReadLine ());//number of people substituting
int[] Fenshu = new int[renshu];//defines an array of fractions of the length of the population
if (Renshu >= 5)//Remove a maximum score, remove two minimum points, so at least five people
{
for (int i = 0; i < Renshu; i++)
{
Console.Write ("Please enter the" + (i + 1) + "judges hit the Score:");
Fenshu[i] = Convert.ToInt32 (Console.ReadLine ());
}
for (int i = 0; i < Renshu; i++)
{
for (int j = i; J < Renshu-1; J + +)//bubble sort, sorted from highest to lowest score
{
if (Fenshu[i] < Fenshu[j + 1])
{
int zhong = 0;
Zhong = fenshu[i];
Fenshu[i] = fenshu[j + 1];
Fenshu[j + 1] = Zhong;
}
}
}
int he = 0;//calculates the total score, with an initial value of 0
for (int i = 0; i < Renshu; i++)
{
He + = fenshu[i];//Cycle calculation score
}
Double PJF = 0;//Initial value is 0
PJF = (he-fenshu[0]-fenshu[1]-fenshu[renshu-1]-fenshu[renshu-2])/(RENSHU-4); Calculates the average score. Fenshu[renshu-1], fenshu[renshu-2]), these two represent the lowest score, and the second lowest score of the penultimate, may not be well understood. In the previous bubble cycle, the scores have been ranked well. Renshu represents the length of the underlying, minus one is the last position of the subscript, which is the lowest
Console.WriteLine ("Remove two highest points" + fenshu[0] + "," + fenshu[1] + ", remove two minimum points" + fenshu[renshu-1] + "," + fenshu[renshu-2 "+ "The final score for the contestant is" + PJF);
}
Else
{
Console.WriteLine ("Please enter a minimum of five persons");
}
Console.ReadLine ();
Example: Green song scoring procedure. Remove the two highest points, remove the two minimum points, and then calculate the average score. The main learning array and bubble sort, under what circumstances to define an array