[英]Looping through an array of strings
I have an array with letters for example 我有一个带字母的数组,例如
string[] arrayLetters = new string[] {"A","B", "C", "D"}
and so on. 等等。
Now a user will type in the number of sets he want to display... 现在用户将输入他想要显示的集合数量...
if for example he types in 2, then the output would be: 例如,如果他键入2,那么输出将是:
AB,AC,AD, BC, BD AB,AC,AD,BC,BD
For a set of three, the output would be like: 对于一组三个,输出将如下:
ABC, ABD, ACD, BCD ABC,ABD,ACD,BCD
... and so on. ... 等等。
Can you please help me solve this little scenario I have? 你能帮我解决一下这个小场景吗?
Thanks Mark Montebello the Cicco 感谢Cicco的Mark Montebello
This Code Project article gives a good overview of combinations (what you are asking), permutations etc and provides a library for calculating them in C#. 此代码项目文章很好地概述了组合(您要问的内容),排列等,并提供了一个用于在C#中计算它们的库。 It's just one of the many libraries that provide this functionality.
它只是提供此功能的众多库中的一个。
BTW combinatorics is introductory computing material. BTW组合学是入门计算材料。 That's why people suspect this may be a school assignment.
这就是人们怀疑这可能是学校作业的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.