请问如何用VB打印一个矩阵内特殊位置的字符? 100
上传不了图片,自己写一个比如下面这个,我要打印16afglqvw,也就是对角线上的字符1,2,3,45,6,7,89,0,a,bc,d,e,fg,h,i,jk,l,m,n...
上传不了图片,自己写一个
比如下面这个,我要打印16afglqvw,也就是对角线上的字符
1,2,3,4
5,6,7,8
9,0,a,b
c,d,e,f
g,h,i,j
k,l,m,n
o,p,q,r
s,t,u,v
w,x,y,z
再比如下面,我要打印1590dhimq
1,2,3
4,5,6
7,8,9
0,a,b
c,d,e
f,g,h
i,j,k
l,m,n
o,p,q
我将这些值给了一个二维数,数组的OPTION BASE 为0,因为某些原因,必须或者说有必要为0,为1会很麻烦。
哪位大神能给我写下代码,我学的不多,就学了些IF,FOR,DO LOOP什么的,就是大学里的计算机基础,但是我不是计算机专业的 展开
比如下面这个,我要打印16afglqvw,也就是对角线上的字符
1,2,3,4
5,6,7,8
9,0,a,b
c,d,e,f
g,h,i,j
k,l,m,n
o,p,q,r
s,t,u,v
w,x,y,z
再比如下面,我要打印1590dhimq
1,2,3
4,5,6
7,8,9
0,a,b
c,d,e
f,g,h
i,j,k
l,m,n
o,p,q
我将这些值给了一个二维数,数组的OPTION BASE 为0,因为某些原因,必须或者说有必要为0,为1会很麻烦。
哪位大神能给我写下代码,我学的不多,就学了些IF,FOR,DO LOOP什么的,就是大学里的计算机基础,但是我不是计算机专业的 展开
2个回答
展开全部
sub main()
a = Array(Array("1", "2", "3", "4"), Array("5", "6", "7", "8"), Array("9", "0", "a", "b"), Array("c", "d", "e", "f"), Array("g", "h", "i", "j"), Array("k", "l", "m", "n")) '初始化数组
b = Array(Array("1", "2", "3"), Array("4", "5", "6"), Array("7", "8", "9"), Array("0", "a", "b"), Array("c", "d", "e"), Array("f", "g", "h"))
mprint a
mprint b
end sub
sub mprint(s) '自定义打印对角 过程
For i = 0 To UBound(s)
t = t & s(i)(i Mod (UBound(s(0)) + 1))
Next
print t
end sub
a = Array(Array("1", "2", "3", "4"), Array("5", "6", "7", "8"), Array("9", "0", "a", "b"), Array("c", "d", "e", "f"), Array("g", "h", "i", "j"), Array("k", "l", "m", "n")) '初始化数组
b = Array(Array("1", "2", "3"), Array("4", "5", "6"), Array("7", "8", "9"), Array("0", "a", "b"), Array("c", "d", "e"), Array("f", "g", "h"))
mprint a
mprint b
end sub
sub mprint(s) '自定义打印对角 过程
For i = 0 To UBound(s)
t = t & s(i)(i Mod (UBound(s(0)) + 1))
Next
print t
end sub
2013-05-16
展开全部
调用正面函数:
Private Function myOutput(myInput As String) As String
Dim i As Integer, myLine() As String, myData() As String
myLine = Split(myInput, vbCrLf)
For i = 0 To UBound(myLine) - 1
myData = Split(myLine(i), ",")
myOutput = myOutput & myData(i Mod (UBound(myData) + 1))
Next
End Function
Private Function myOutput(myInput As String) As String
Dim i As Integer, myLine() As String, myData() As String
myLine = Split(myInput, vbCrLf)
For i = 0 To UBound(myLine) - 1
myData = Split(myLine(i), ",")
myOutput = myOutput & myData(i Mod (UBound(myData) + 1))
Next
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询