将int去掉,将 “/”号 换成 “\”号,代码更简洁。
心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
[此贴子已经被作者于2022-9-18 16:31编辑过]
Function GetStr(Num) Select Case Num Case 1: GetStr = "A" Case 2: GetStr = "B" Case 3: GetStr = "C" Case 4: GetStr = "D" Case 5: GetStr = "E" Case 6: GetStr = "F" Case 7: GetStr = "G" Case 8: GetStr = "H" Case 9: GetStr = "I" Case 10: GetStr = "J" Case 11: GetStr = "K" Case 12: GetStr = "L" Case 13: GetStr = "M" Case 14: GetStr = "N" Case 15: GetStr = "O" Case 16: GetStr = "P" Case 17: GetStr = "Q" Case 18: GetStr = "R" Case 19: GetStr = "S" Case 20: GetStr = "T" Case 21: GetStr = "U" Case 22: GetStr = "V" Case 23: GetStr = "W" Case 24: GetStr = "X" Case 25: GetStr = "Y" End Select End Function
Dim num1 As Long, num2 As Long Dim num3 As Long, num4 As Long Dim i As Long, j As Long, k As Long i = Val(Text1.Text) If i > 406900 Or i < 1 Then Exit Sub '超范围 j = 16276 '默认减值 1+1*25+1*25*25+1*25*25*25 k = 4 '默认有4个值 If i < 16276 Then j = 651: k = 3 '如果小于 1+1*25+1*25*25+1*25*25*25,只有3个值 If i < 651 Then j = 26: k = 2 '如果小于 1+1*25+1*25*25,只有2个值 If i < 26 Then j = 1: k = 1 '如果小于 1+1*25 ,只有1个值 i = i - j 'wmf2014 写成了循环,因你要求单变量输出,只能改为4组命令 num1 = i Mod 25 + 1 '取最低位 i = i \ 25 '移位 If k > 1 Then '如果还有更多的位 num2 = i Mod 25 + 1 '同上取最低位,移位 i = i \ 25 End If If k > 2 Then num3 = i Mod 25 + 1 i = i \ 25 End If If k > 3 Then num4 = i Mod 25 + 1 i = i \ 25 End If Label1.Caption = num1 Label2.Caption = num2 Label3.Caption = num3 Label4.Caption = num4 Label5.Caption = num1 & " + " & num2 & " * 25 + " & num3 & " * 25 * 25 + " & num4 & " * 25 * 25 * 25 "
[此贴子已经被作者于2022-9-19 00:57编辑过]