MC 自己平均

using System;
using System.Drawing;
using System.Linq;
using System.Collections; namespace PowerLanguage
{
namespace Function
{
public class MyAvg
{ public static double Avg(ArrayList list,int length)
{ if(list.Count < length ) return 0.0 ; double all = 0.0 ;
for(int i = list.Count - length ; i< list.Count; i++)
{
all += (Double)list[i]; }
if(list.Count >) {
return all/length;
} return 0.0 ;
} public static ArrayList ma(ArrayList price, int length,int limit)
{ if (price.Count < length) return null; if (length + limit- > price.Count) return null; ArrayList temparray = new ArrayList(); for (int i = ; i < length+limit-; i++)
{ if (i < length - ) continue; double temp = ; for (int j = i; j > i - length; j--)
{ temp += (double)price[j]; } temparray.Add(temp / length);
Console.WriteLine("---------------------" + temp);
} return temparray;
} }
}
}
上一篇:Android开发教程AnimationDrawable逐帧播放动画


下一篇:【ShaderToy】跳动的心❤️