首页 > 聚焦 > 正文

vba代码一对多查找_vb代码|全球时快讯

2023-03-01 22:06:02   来源:互联网  


(资料图片)

最近这段时间总有小伙伴问小编vba代码一对多查找_vb代码是什么,小编为此在网上搜寻了一些有关于vba代码一对多查找_vb代码的知识送给大家,希望能解答各位小伙伴的疑惑。

1、Option ExplicitFunction fc(a) As BooleanDim i As LongFor i = 2 To Int(a / 2)If a Mod i = 0 Thenfc = FalseExit ForElsefc = TrueEnd IfNext iEnd FunctionPrivate Sub Form_Click()Dim i, j, k, m, s, g, f As Integerj = 0k = 0f = 0Dim a(1 To 80) As IntegerDim b(1 To 80) As IntegerDim c(1 To 80) As IntegerDim d(1 To 80) As IntegerFor i = 1 To 80a(i) = Int(Rnd() * 100)if a(i)<10 then a(i)=a(i)+10If a(i) Mod 2 = 0 Thenj = j + 1b(j) = a(i)Elsek = k + 1c(k) = a(i)End IfNext iFor i = 1 To jFor m = i + 1 To jIf b(i) < b(m) Thens = b(m)b(m) = b(i)b(i) = sEnd IfNext mNext iFor i = 1 To kFor m = i + 1 To kIf b(i) < b(m) Thens = c(m)c(m) = c(i)c(i) = sEnd IfNext mNext iFor i = 1 To 80If fc(a(i)) = True Theng = g + 1d(g) = a(i)End IfNext iPrint "随机数:"For i = 1 To 80f = f + 1If f < 11 ThenPrint " " & a(i);Elsef = 1PrintPrint " " & a(i);End IfNext iPrintPrint "偶数:"f = 0For i = 1 To jf = f + 1If f < 11 ThenPrint " " & b(i);Elsef = 1PrintPrint " " & b(i);End IfNext iPrintPrint "奇数:"f = 0For i = 1 To kf = f + 1If f < 11 ThenPrint " " & c(i);Elsef = 1PrintPrint " " & c(i);End IfNext iPrintPrint "素数:"f = 0For i = 1 To gf = f + 1If f < 11 ThenPrint " " & d(i);Elsef = 1PrintPrint " " & d(i);End IfNext is = 0PrintPrint "素数个数:" & gFor i = 1 To gs = s + d(i)Next iPrint "素数总和:" & sEnd Sub。

关键词:

推荐内容

Copyright www.caikuang.mbahome.com 版权所有
网站备案号:沪ICP备2020036824号-3
邮箱:562 66 29@qq.com