符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
其实我是看到悬赏分进来的,这个,你先试着写,碰到什么问题,再问吧,可以百度Hi我!!
创新互联建站主要从事网站设计制作、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务耀州,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
在WinForm项目的窗体上添加一个按钮和文本框,然后把下面的代码粘贴上去就可以了。
Public Function lsH(ByVal n As String) As String
Dim s1 As String = ""
Dim s2 As String = ""
Dim i As Integer = 0
Dim j As Integer
If n.Length = 1 Then
Return ("是回文数")
Else
If Tell_JiOu(n.Length) = 1 Then
j = (n.Length + 1) / 2
s1 = Mid(n, 1, j)
Else
j = n.Length / 2 + 1
s1 = Mid(n, 1, j - 1)
End If
For i = n.Length To j Step -1
s2 = s2 + Mid(n, i, 1)
Next
If s1 = s2 Then
Return "是回文数"
Else
Return "不是回文数"
End If
End If
End Function
'判断一个整数的奇偶
Public Function Tell_JiOu(ByVal k As Integer) As Integer
If k Mod 2 = 0 Then
Return 2
Else
Return 1
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Button.Text = lsH(TextBox1.Text)
End Sub
你的i = Len(Str(a))会出问题。
If i 1 Then
Return True
End If
这个返回在if内部,当条件不满足将导致函数无返回。
以下代码仅供参考:
Function IsH(ByVal a As Long) As Boolean
Dim i As Long, j As Long, t As String
t = a.ToString
i = t.Length
Select Case i
Case 1
Return True
Case 2
If Mid(t, 1, 1) = Mid(t, 2, 1) Then Return True Else Return False
Case 3
If Mid(t, 1, 1) = Mid(t, 3, 1) Then Return True Else Return False
Case Else
For j = 1 To i \ 2
If Mid(t, j, 1) Mid(t, i - j + 1, 1) Then Return False
Next j
End Select
Return True
End Function
判断一个数是否为回文数吗?
Private Function IsH(a As String) As Boolean
Dim l As Integer
l = Len(a)
IsH = True
For i = 1 To l / 2
If Mid(a, i, 1) Mid(a, l + 1 - i, 1) Then
IsH = False
Exit For
End If
Next i
End Function
用这个函数