猿问

关于vb编程题,求解释,具体内容请看:

设计一个判断某正数是否为回文数的算法。所谓回文数是指左右数字完全对称的自然数。例如121,12321,888,55.

慕无忌1623718
浏览 394回答 2
2回答

FFIVE

Private Sub Command1_Click()Dim n As Stringn = InputBox("请输入一个整数:")If n = StrReverse(n) ThenPrint "是回文数。"ElsePrint "不是回文数"End IfEnd Sub

红颜莎娜

Private Sub Command1_Click()Dim i As IntegerDim h As Booleanh = TrueFor i = 1 To Int(Len(Text1.Text) / 2)If Mid(Text1.Text, i, 1) <> Mid(Text1.Text, Len(Text1.Text) - i + 1, 1) Thenh = FalseExit ForEnd IfNextIf h = True ThenMsgBox "回数"ElseMsgBox "不是回数"End IfEnd Sub
随时随地看视频慕课网APP
我要回答