数学中国

 找回密码
 注册
搜索
热搜: 活动 交友 discuz
查看: 85|回复: 0

求循环节长度的程序

[复制链接]
发表于 2025-3-31 18:57 | 显示全部楼层 |阅读模式
本帖最后由 ysr 于 2025-3-31 11:14 编辑

代码如下:

Private Sub Command1_Click()
'求循环节长度的程序,循环节必须大于5
Dim s As String
s = Text1
s1 = Mid(s, 1, 5)

For j = 6 To Len(s)
If s1 = Mid(s, j, 5) Then
s2 = 1
js = j
Exit For
End If

Next
If s2 = 1 Then
Text2 = "循环节长度" & js - 1 & "  循环节: “" & s1 & "……" & Mid(s, js - 1, 1) & "” "
Else
Text2 = "不循环"
End If

End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""

End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|数学中国 ( 京ICP备05040119号 )

GMT+8, 2025-4-30 16:57 , Processed in 0.098758 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表