1个回答
展开全部
Option Base 1
Private Sub Command1_Click()
Dim A(3, 3) As Integer, I As Integer, J As Integer, K As Integer
I = 3: J = 1
A(I, J) = 1
For K = 2 To 9
If I + 1 > 3 Or J + 1 > 3 Then
If J = 1 Then
I = I - 1
ElseIf A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
ElseIf J = 3 Then
I = I - 1
Else
J = J + 1
End If
ElseIf J = 1 Or I = 1 Then
If A(I + 1, J + 1) = 0 Then
I = I + 1: J = J + 1
Else
J = J + 1
End If
Else
If A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
End If
End If
A(I, J) = K
Next K
For I = 1 To 3
For J = 1 To 3
Print A(I, J)
Next J
Print
Next I
End Sub
抄得时候不要丢行,你前面丢了:
Option Base 1
还丢了:
ElseIf A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
Private Sub Command1_Click()
Dim A(3, 3) As Integer, I As Integer, J As Integer, K As Integer
I = 3: J = 1
A(I, J) = 1
For K = 2 To 9
If I + 1 > 3 Or J + 1 > 3 Then
If J = 1 Then
I = I - 1
ElseIf A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
ElseIf J = 3 Then
I = I - 1
Else
J = J + 1
End If
ElseIf J = 1 Or I = 1 Then
If A(I + 1, J + 1) = 0 Then
I = I + 1: J = J + 1
Else
J = J + 1
End If
Else
If A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
End If
End If
A(I, J) = K
Next K
For I = 1 To 3
For J = 1 To 3
Print A(I, J)
Next J
Next I
End Sub
抄得时候不要丢行,你前面丢了:
Option Base 1
还丢了:
ElseIf A(I - 1, J - 1) = 0 Then
I = I - 1: J = J - 1
更多追问追答
追问
那算出来是多少?为什么我就算到A(2,2)=3然后就算不出来了?我是说笔算
那算出来是多少?为什么我就算到A(2,2)=3然后就算不出来了?我是说笔算
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
单片机,即单片微控制器,也称为单片微型计算机,是将中央处理器(CPU)、存储器(ROM,RAM)、输入/输出接口和其他功能部件集成在一块 在一个小块的集成电路上,从而实现对整个电路或系统的数字式控制。单片机不是完成某一个逻辑功能的芯片,而是...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询