How to use PHP to implement the jury raters, PHP to achieve the jury rating
Using the Select Sort method, the first step is to find the highest and lowest points from the input array, and then remove a maximum score and a minimum score to get the average score of the contestants.
1. Implementing the Code
<?phpfunction Fairscore (& $arr) {//Select the first step in the sorting method, it is only necessary to find the maximum and minimum values in this array, it is not necessary to sort the entire array $minVal = $arr [0]; $minIndex = 0; $maxVal = $arr [0]; $maxIndex = 0; $sum = 0; for ($i =1; $i
<$minval) $minval="$arr[$i];;" $minindex="$i;" }="" ($arr[$i]="">
$maxVal) { $maxVal = $arr [$i]; $maxIndex = $i; } The echo "Highest score is:" $maxVal. "The lowest score is:" $minVal. "
"; for ($i =0; $i
The average score after the highest and lowest points is removed
<?phpfairscore ($aScore);? >
2. Running
The above is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/1041324.html www.bkjia.com true http://www.bkjia.com/PHPjc/1041324.html techarticle How to use PHP to implement the jury raters, PHP implementation judges scoring with the choice of sorting method The first step from the input array to find the highest and lowest points, and then remove a highest score and a minimum score ...