赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 535 |
最后登录 | 2014-3-15 |
在线时间 | 5 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 5 小时
- 注册时间
- 2014-2-6
- 帖子
- 10
|
5楼

楼主 |
发表于 2014-2-7 12:50:11
|
只看该作者
铃仙·优昙华院·因幡 发表于 2014-2-7 12:25 ![]()
得到的就是排好顺序的数字了.
如果你想获取的是一串数字里最大或者最小的那个, 也可以用默认的方法来解决. ... - def m (a)
- d = a
- return d
- end
- mer = m (rand(100) ).to_s
- p mer
-
- def ma(b)
- d = b
- return d
- end
- maer = ma (rand(100) ).to_s
- p maer
-
- def max(c)
- d = c
- return d
- end
- maxer = max(rand(100) ).to_s
- p maxer
-
- e = [mer, maer,maxer]
- p [e[0],e[1],e[2]] if e[0]>e[1] and e[0]>e[2] and e[1]>e[2]
- p [e[0],e[2],e[1]] if e[0]>e[1] and e[0]>e[2] and e[2]>e[1]
-
- p [e[1],e[0],e[2]] if e[1]>e[0] and e[1]>e[2] and e[0]>e[2]
- p [e[1],e[2],e[0]] if e[1]>e[0] and e[1]>e[2] and e[2]>e[0]
-
- p [e[2],e[0],e[1]] if e[2]>e[0] and e[2]>e[1] and e[0]>e[1]
- p [e[2],e[1],e[0]] if e[2]>e[0] and e[2]>e[1] and e[1]>e[0]
复制代码 自己想了半天,就想出了这个。可我发现了个问题, 这是次排序的数量还好是3个,要是30个岂不是麻烦死?{:2_264:}新人刚学脚本,你那个我看的不是特别懂(我自己太笨)。 |
|