Home  >  Article  >  php教程  >  如何使用php实现评委评分器

如何使用php实现评委评分器

WBOY
WBOYOriginal
2016-06-06 19:49:581489browse

本文主要介绍了如何使用php实现评委评分器,从输入的数组中去掉最高分和最低分,算出平均分,需要的朋友可以参考下

用选择排序法第一步从输入的数组中找到最高分和最低分,然后去掉一个最高分和一个最低分,得出选手的平均分。

1. 实现代码

$maxVal) { $maxVal = $arr[$i]; $maxIndex = $i; } } echo "最高分是:".$maxVal." 最低分是:".$minVal."
"; for ($i=0;$i 去掉最高分和最低分后的平均分

请输入各个评委的打分,中间用空格隔开

2. 运行效果图

如何使用php实现评委评分器

以上就是本文的全部内容,,希望大家可以喜欢。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn