vb程序中定义一个名为sx的函数过程,用于判断一个正整数是否为升序数

来源:百度知道 编辑:UC知道 时间:2024/05/10 14:27:32
我真的很急
'

没说明什么是升序数
下面的函数判断1222是的,(单数算不算?没考虑)
Public Function sx(ByVal n As Integer) As Boolean
Dim s As String
s = CStr(n)
c = Left(s, 1)
sx = True
For i = 2 To Len(s)
c1 = Mid(s, i, 1)
If c > c1 Then sx = False: Exit For
c = c1
Next i
End Function