编程论坛
注册
登录
编程论坛
→
VB6论坛
排列组合问题
day158
发布于 2012-04-30 07:34, 297 次点击
如下题:
甲乙丙丁戊己庚辛壬癸
子丑寅卯辰巳午未申酉戍亥
排列组合成:甲子,乙丑,丙寅,,,,,丙子,丁丑,戊寅,,,,,癸亥时的六十甲子组合
求解代码应如何写?
1 回复
#2
wube
2012-05-01 00:14
Dim Path1() as string
Dim Path2() as string
Dim Path3() as string
Dim i ,j, k as intxxx
Const String1="甲"
Const String2="子"
j=0
for i=0 to 10*i-1 setp (1 or 2)
redim Pxxxx Path1(j)
Path1(j)=Chr(Asc(String1)+i) 'i要看是1字节或2字节
j=j+1
next i
j=0
for i=0 to 12*i-1 setp (1 or 2)
redim Pxxxx Path2(j)
Path2(j)=Chr(Asc(String2)+i) 'i要看是1字节或2字节
j=j+1
next i
k=0
for i=0 to UBound(Path1)
for j=0 to UBound(Path2)
redim Pxxxx Path3(k)
Path3(k)=Path1(i) & Path2(j)
k=k+1
next j
next i
猜大概是这感觉~
[
本帖最后由 wube 于 2012-5-1 02:23 编辑
]
1