vb如何用inputbox生成3乘3的100以内的矩阵,并把矩阵输入在picture1窗口中?

vb如何用inputbox生成3乘3的100以内的矩阵,并把矩阵输入在picture1窗口中,并找出其中的最大值和最小值以及最大值最小值的下标输入在picture2中,求完整代码 谢谢!

1、用inputbox()函数输入9个100以内的数,用split分解,用for循环生成矩阵,并用for循环输出到picture1。

2、所需要工具:vb6

3、示例如下:

Private Sub Command1_Click()
    Dim n As String, a() As String
    Dim b(2, 2) As Integer
    Dim i As Integer, j As Integer
    n = InputBox("请输入9个数用逗号分隔", , "1,2,3,4,5,6,7,8,9")
    a = Split(n, ",")
    For i = 0 To 2
     For j = 0 To 2
      b(i, j) = a(3 * i + j)
     Next
    Next
    
    For i = 0 To 2
     For j = 0 To 2
       Picture1.Print b(i, j);
     Next
     Picture1.Print
    Next

End Sub

4、注意矩阵赋值顺序。

温馨提示:内容为网友见解,仅供参考
无其他回答

vb如何用inputbox生成3乘3的100以内的矩阵,并把矩阵输入在picture1窗口...
1、用inputbox()函数输入9个100以内的数,用split分解,用for循环生成矩阵,并用for循环输出到picture1。2、所需要工具:vb6 3、示例如下:Private Sub Command1_Click() Dim n As String, a() As String Dim b(2, 2) As Integer Dim i As Integer, j As Integer n = InputB...

vb编写一个龟兔赛跑程序,代码
每次翻倍压比如:5、10、20、30、40" & vbCrLf & "风险:赢一场得3倍,输一场全部完蛋,一般翻倍到50就收手" & vbCrLf & "几率:75%中标" & vbCrLf & "总结:属于高风险高收入的一种,赢到500++金币就一定要收手", vbYes, "高风险-高回报-高几率"...

VB矩阵乘法程序
j) = InputBox("请输入矩阵A", "提示") Picture1.Print a(i, j);Next jPicture1.PrintNext iPicture1.PrintEnd Sub'矩阵B输入程序Private Sub Command2_Click()Dim c As IntegerDim i As Integer, j As Integerc = InputBox("请输入B矩阵行数", "提示")m = InputBox("请输入B矩阵...

求VB矩阵运算系统 代码
m = InputBox("请输入A矩阵行数", "提示")n = InputBox("请输入A矩阵列数", "提示")Picture1.Cls Picture3.Cls ReDim a(1 To m, 1 To n) As Long For i = 1 To m For j = 1 To n a(i, j) = InputBox("请输入矩阵a(" & i & "," & j & ")数值", "提示")Pi...

vb 矩阵乘法运算?
1 To n a(i, j) = InputBox("请输入矩阵A", "提示")Picture1.Print a(i, j);Next j Picture1.Print Next i Picture1.Print End Sub '矩阵B输入程序 Private Sub Command2_Click()Dim c As Integer Dim i As Integer, j As Integer c = InputBox("请输入B矩阵行数", "提示")

用VB来写代码,用循环if或do来写:随机产生n个(1~100)之间的数,求它们的...
xiao = 100 For i = 1 To n '输入到文本 Text1 = Text1 & suiji(i) & " "If suiji(i) > da Then da = suiji(i)If suiji(i) < xiao Then xiao = suiji(i)s = s + suiji(i)Next i Text1 = Text1 & vbCrLf & "最大:" & da & vbCrLf & "最小:" & xiao & ...

vb 画圆问题
vb 画圆 画在picture里 Private Sub Command1_Click() Dim x, y, r x = InputBox("请输入圆心座标x", "引数输入", 30) y = InputBox("请输入圆心座标y", "引数输入", 30) r = InputBox("请输入半径r", "引数输入", 15) Picture1.ScaleMode = 3 Picture1.Circle (...

vb 画圆 画在picture里
Private Sub Command1_Click()Dim x, y, r x = InputBox("请输入圆心坐标x", "参数输入", 30)y = InputBox("请输入圆心坐标y", "参数输入", 30)r = InputBox("请输入半径r", "参数输入", 15)Picture1.ScaleMode = 3 Picture1.Circle (x, y), r, , 0, 0 End Sub ...

vb中picture控件中的输出为什么残缺不全?
有个语句位置错了 Option Base 1 Private Sub Command1_Click()Dim a() As Integer, m As Integer, n As Integer Dim st As Double m = InputBox("请输入", "矩阵的行", u)n = InputBox("请输入", "矩阵的列", l)Sum = 0 Randomize ReDim a(m, n)For i = 1 To m For j...

求大神解答VB魔方矩阵代码
Private Sub Command1_Click()Dim a(19, 19) As Integer n = Val(InputBox("请输入一个3~19之间的奇数:"))If n < 3 Or n > 19 Or n Mod 2 = 0 Then MsgBox ("输入的N不对!"): Exit Sub i = 1: j = n \\ 2 + 1: k = 1 While k <= n * n For t = 1 To n...

相似回答
大家正在搜