如何将表排序为增加数字顺序? [英] How do I sort a table into increasing numerical order?

查看:66
本文介绍了如何将表排序为增加数字顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以基本上,我有一堆阵列都聚集在一起形成一张桌子。

而且我想把它放到递增的顺序



我尝试过:



 x = 1到6 
控制台。 WriteLine({0,-10} {1,-6} {2,-7} {3,-7} {4,-10} {5,-5},name(x),sum,wins,失去了,roundsWon,淘汰赛)
下一

解决方案
的办法,我会做到这一点是扔掉你的单独的阵列,并创建一个容器类,其中包含单个人的详细信息:名称和结果。

然后创建一个这样的数组并相应地填充每个实例。

然后您可以订购数组按名称或结果重新排序数组,其他人的信息随之自动移动。


So basically, I have a bunch of arrays which all come together to form a table.
And I want to put it into increasing order

What I have tried:

For x = 1 to 6
        Console.WriteLine("{0,-10} {1,-6} {2,-7} {3,-7} {4,-10} {5,-5}", name(x), sum, wins, lost, roundsWon, knockout)
next

解决方案

The way I would do it is to throw away your separate arrays, and create a "container class" which holds a single persons details: name and results.
Then create an array of these and populate each instance accordingly.
You can then order the array by name or results by reordering the array and the other information about the person automatically moves with it.


这篇关于如何将表排序为增加数字顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆