求一段用实现排行榜的代码,最好是C#的

来源:百度知道 编辑:UC知道 时间:2024/06/16 21:56:30
我个人的想法是:
排行榜共显示10个记录
设11个数
其中10个位全空
剩余oper一个存储玩家刚才的记录
如果oper大于排行榜中的top10,跳出对话框,玩家输入名字,并单击确定。
然后,oper通过冒泡与10个记录比较,并确定top几。
请大家提下看法。
如果有代码就感激不尽了……
本人目前积分25分,悬赏20分。
偶想要的代码是无比详细的
可以不要注释
但要从using开始 一直到最后的花括号
要么就是巨详细的思路
神哇~
有需要我可以倾家荡产哈~

用List<int> sco保存排位,且已有10个数据。
下面代码仅适合int型数据。
另一个可供解决的方法为实现一个特别的类,继承IComparer<object>

//判断句
if(sco[9]<oper. Results){
sco[9]=oper.Results;
sco=newsco(sco);
}

//method
List<int> newsco(List<int> os){
List<int> temp=new List<int>();
for(int i=0;i<os.length;i++){
temp.add(getmax(os));
os.remove(getmax(os));
}
return temp;
}

//method to get the max number
int getmax(List<int> os){
int temp=os[0];
foreach(int i in os){
if(i>temp)
temp=i;
}
return temp;
}

哇哈,草泥马