每个可能的3位数组合发生器 [英] Every possible 3 digit combination generator

查看:62
本文介绍了每个可能的3位数组合发生器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 -

我正在尝试编译一个应用程序,使用0-9和az生成所有可能的3

数字组合,我看了无处不在的

解决方案,我找到了组合! v 2.0 for windows,但是我更愿意实现我自己的解决方案,而不是购买软件来执行一项小任务。谢谢!

解决方案

" D" < em ******* @ comcast.netwrote in message

news:11 ********************** @ j27g2000cwj.googlegr oups.com ...


大家好 -

我正在尝试编译应用程序以生成所有可能的3

使用0-9和az的数字组合,我到处找了一个

解决方案,我找到了组合! v 2.0 for windows,但是我更愿意实现我自己的解决方案,而不是购买软件来执行一项小任务。谢谢!



就个人而言,我只会嵌套三个for / next循环并通过ascii

值0-9当我点击9,跳转到ascii代码。但我怀疑这是正确的答案。


我把它从其他人身上蹦了出来,他说他可能会建造一个

36个元素并用于循环。


这听起来像是一个家庭作业,所以我真的不觉得

很乐意为你提供实际的代码。


上述两种解决方案都可行,但我不知道''正确''

答案(或方法)将是。就我个人而言,我一直是一个更大的粉丝。

''它有效'而不是''我用正确的方式做到了。''





1月26日下午1点31分,D < email0 ... @ comcast.netwrote:


大家好 -

我正在尝试编译一个应用程序来生成所有可能3

使用0-9和az的数字组合,我到处寻找一个

解决方案,我找到了组合! v 2.0 for windows,但是我更愿意实现我自己的解决方案,而不是购买软件来执行一项小任务。谢谢!



不要太难......

你需要3个嵌套循环:

外循环:更改最左边的字符

中间循环:将中间字符更改为每个允许的数字

外循环的每次迭代

内循环:将正确的字符更改为每个允许的数字

中循环的foreach迭代。


伪代码:


foreach left_character in [0-9a-z]

foreach middle_character in [0-9a-z]

foreach right_character in [0-9a-z]

打印left_character,middle_character,right_character

endloop

endloop

endloop


我还没有尝试证明这会起作用,但看起来很漂亮

关闭。


我可以看到这可能非常有用。人们可能想知道hmm是2b9。 a

有效的3位字母数字组合然后他们可以运行

程序并留意它。或者有人可能会问有多少g / b
组合必须。现在他们可以运行程序并计算

吧。


你可能会告诉我们你到目前为止的代码......


D < em ******* @ comcast.netwrote in message

news:11 ********************** @ j27g2000cwj.googlegr oups.com ...


大家好 -

我正在尝试编译应用程序以生成所有可能的3

使用0-9和az的数字组合,我到处找了一个

解决方案,我找到了组合! v 2.0 for windows,但是我更愿意实现我自己的解决方案,而不是购买软件来执行一项小任务。谢谢!



Hello everyone -
I''m trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I''ve looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!

解决方案

"D" <em*******@comcast.netwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...

Hello everyone -
I''m trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I''ve looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!

Personally, I''d just nest three for/next loops and go through the ascii
values for 0-9 and when I hit 9, jump up to the ascii code for a. But I
doubt that''s the right answer.

I bounced it off someone else, and he said he''d probably build an array of
the 36 elements and use that for the loops.

This honestly sounds like a homework assignment so I don''t really feel
comfortable giving you actual code to do it.

Both of the solutions above would work, but I have no idea what the ''right''
answer (or method) would be. Personally, I''ve always been a bigger fan of
''It works'' than of ''I did it the right way.''




On Jan 26, 1:31 pm, "D" <email0...@comcast.netwrote:

Hello everyone -
I''m trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I''ve looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!

Shouldn''t be too hard...
You''ll need 3 nested loops:
Outer loop: changes the leftmost character
Middle loop: changes the middle character to every allowable digit for
each iteration of the Outer loop
Inner loop: changes the right character to every allowable digit
foreach iteration of the Middle loop.

pseudocode:

foreach left_character in [0-9a-z]
foreach middle_character in [0-9a-z]
foreach right_character in [0-9a-z]
print left_character,middle_character,right_character
endloop
endloop
endloop

I haven''t actually tried proving this will work, but it looks pretty
close.


I can see how this could be very useful. One might wonder hmm is "2b9" a
valid 3-position alpha-numeric combination and then they could run the
program and keep an eye out for it. Or one might ask "how many gazillions of
combinations must that be" and now they could just run the program and count
them.

You might show us the code you have so far...

"D" <em*******@comcast.netwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...

Hello everyone -
I''m trying to compile an application to generate all possible 3
digit combinations using 0-9 and a-z, I''ve looked everywhere for a
solution and I found Combinations! v 2.0 for windows, but I was more
looking to implement my own solution rather than buy software to
perform a small task. Thanks!



这篇关于每个可能的3位数组合发生器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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