VB 求10000-99999之间的全部回文式素数我写的程序如下,始终显示ByRef的参数类型错误,Private Function fact(n%) As BooleanDim s%fact = TrueFor s = 2 To n - 1If n Mod i = 0 Thenfact = FalseExit ForEnd IfNext iEnd FunctionPrivate

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 00:56:52
VB求10000-99999之间的全部回文式素数我写的程序如下,始终显示ByRef的参数类型错误,PrivateFunctionfact(n%)AsBooleanDims%fact=TrueFors=

VB 求10000-99999之间的全部回文式素数我写的程序如下,始终显示ByRef的参数类型错误,Private Function fact(n%) As BooleanDim s%fact = TrueFor s = 2 To n - 1If n Mod i = 0 Thenfact = FalseExit ForEnd IfNext iEnd FunctionPrivate
VB 求10000-99999之间的全部回文式素数
我写的程序如下,始终显示ByRef的参数类型错误,
Private Function fact(n%) As Boolean
Dim s%
fact = True
For s = 2 To n - 1
If n Mod i = 0 Then
fact = False
Exit For
End If
Next i
End Function
Private Function hws(n%) As Boolean
Dim data%,ten%,thu%,wan%
data = n Mod 10
ten = (n \ 10) Mod 10
thu = (n \ 1000) Mod 10
wan = n \ 10000
If data = wan And ten = thu Then
hws = True
End If
End Function
Private Sub Command1_Click()
Dim ,k%
For i = 10000 To 99999
If fact(i) = True And hws(i) = True Then
k = k + 1
Print i;
If k Mod 7 = 0 Then
Print
End If
End If
Next i
End Sub

VB 求10000-99999之间的全部回文式素数我写的程序如下,始终显示ByRef的参数类型错误,Private Function fact(n%) As BooleanDim s%fact = TrueFor s = 2 To n - 1If n Mod i = 0 Thenfact = FalseExit ForEnd IfNext iEnd FunctionPrivate
integer % 短整型
long & 长整型
single !单精度浮点型
double # 双精度浮点型
currency @ 货币型
string $ 字符型
你的程序
Private Sub Command1_Click()
Dim i!,k%
If fact(i) = True And hws(i) = True Then
和这个地方
Private Function fact(n%) As Boolean
的传值有问题,不是同一种数据类型