请求VB高手 Option Explicit Option Base 0 Dim a() As Integer Private Sub Command1_Click() Dim m As L
OptionExplicitOptionBase0Dima()AsIntegerPrivateSubCommand1_Click()DimmAsLong,nAsLong,...
Option Explicit
Option Base 0
Dim a() As Integer
Private Sub Command1_Click()
Dim m As Long, n As Long, i As Long
m = Text1.Text: n = Text2.Text
For i = m To n
If pd(i) Then
Text3 = CStr(i) & "=" & CStr(a(4)) & "^4+" & CStr(a(3)) & "^4+" & CStr(a(2)) & "^4+" & CStr(a(1)) & "^4" & vbCrLf
End If
Next i
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Function pd(ByVal i As Long) As Boolean
Dim j As Integer, k As Integer, n As Long
n = i
Do
j = n Mod 10
n = n \ 10
k = k + 1
ReDim Preserve a(k)
a(k) = j
Loop Until i = 0
If a(1) ^ 4 + a(2) ^ 4 + a(3) ^ 4 + a(4) ^ 4 = i Then
pd = True
End If
End Function
在运行的时候,总是说数组a()的下标越界 展开
Option Base 0
Dim a() As Integer
Private Sub Command1_Click()
Dim m As Long, n As Long, i As Long
m = Text1.Text: n = Text2.Text
For i = m To n
If pd(i) Then
Text3 = CStr(i) & "=" & CStr(a(4)) & "^4+" & CStr(a(3)) & "^4+" & CStr(a(2)) & "^4+" & CStr(a(1)) & "^4" & vbCrLf
End If
Next i
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Function pd(ByVal i As Long) As Boolean
Dim j As Integer, k As Integer, n As Long
n = i
Do
j = n Mod 10
n = n \ 10
k = k + 1
ReDim Preserve a(k)
a(k) = j
Loop Until i = 0
If a(1) ^ 4 + a(2) ^ 4 + a(3) ^ 4 + a(4) ^ 4 = i Then
pd = True
End If
End Function
在运行的时候,总是说数组a()的下标越界 展开
展开全部
标题党。。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
问题呢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询