日期:2014-05-17 浏览次数:20615 次
int count_high = 0, count_lower = 0;
if (count_high == 0 && Label1.Text == max)
{
Label1.ForeColor = System.Drawing.Color.Red;
count_high++;
}
if (count_lower == 0 && Label1.Text == min)
{
Label1.ForeColor = System.Drawing.Color.Red;
count_lower++;
}
------解决方案--------------------
//将八个分数放到一个数组,我下面的以int型数组为例(当然你的是float数组)
int[] arr = {9,12,1, 2, 4, 5, 6 };
ArrayList list = new ArrayList(arr);
list.Sort();
int min = Convert.ToInt32(list[0]);
int max = Convert.ToInt32(list[list.Count - 1]);
Response.Write("最大" + max + " 最小:" + min); //输出12,1