数组,名字和得分排名

var arr:Array=[300,290,280,270,250];
            var nameArr:Array=["李一","杜二","王三","高五","苏六"];
            var num:Number=HuiShi.totalCoreNum;
            
            var nameStr:String=thisMc["nameTxt"].text;
            var lastNum:Number;
            var newArr:Array=[];
            var sliceNum:Number;
            arr.push(num);
            arr.sort();
            if (num<300) {
                sliceNum=4;
                newArr.push(300);
            } else {
                sliceNum=5;
            }
            for (var i:uint=0; i<=sliceNum; i++) {
                newArr.push(arr[i]);
            }
            newArr.sort();
            lastNum=newArr.lastIndexOf(num);
            nameArr.splice(lastNum,0,nameStr);

 

posted on 2019-09-05 10:41  zqiang0803  阅读(281)  评论(0编辑  收藏  举报

导航