以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]请教各位大神,如何编写如QQ等级一样的等级计算 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=162115) |
-- 作者:mygoldbird -- 发布时间:2021/4/6 14:14:00 -- [求助]请教各位大神,如何编写如QQ等级一样的等级计算 比如:X是已能计算出的积分总量。 然后计算方式是: 100=1A 5A=1B 3B=1C 3C=1D (或是这样理解,A=100 B=500 C=1500 D=4500) 想要求的是,已知“X”能得到多少个C多少个B多少个A还余多少! 如: 6650=1D+1C+1B+1A+50 (就像QQ的太阳月亮星星的那种) 谢谢各位大家佬!万分感谢~ |
-- 作者:有点蓝 -- 发布时间:2021/4/6 14:23:00 -- Dim s1() As String = {"a","b","c","d"} Dim s2() As String = {"100","500","1500","4500"} Dim d As Integer = 6650 Dim s As String = "" For i As Integer = s1.length - 1 To 0 Step -1 Dim d1 As Integer = math.Floor(d / s2(i)) d = d Mod s2(i) s = s & d1 & s1(i) & "," Next s = s & d Output.Show(s)
|
-- 作者:mygoldbird -- 发布时间:2021/4/6 14:36:00 -- 谢谢您!追加一个问题,如第一列是X,那我怎么在第二列展示这个结果!感谢感谢 |
-- 作者:有点蓝 -- 发布时间:2021/4/6 14:38:00 -- 参考:http://www.foxtable.com/webhelp/topics/0625.htm If e.DataCol.Name = "第一列" Then \'如果更改的是身份证号码列
If e.DataRow.IsNull("第一列") Then \'身份证号码是否为空 e.DataRow("第二列") = Nothing \'如果为空,则清除出生日期 Else Dim s1() As String = {"a","b","c","d"} Dim s2() As String = {"100","500","1500","4500"} Dim d As Integer = e.DataRow("第一列") Dim s As String = "" For i As Integer = s1.length - 1 To 0 Step -1 Dim d1 As Integer = math.Floor(d / s2(i)) d = d Mod s2(i) s = s & d1 & s1(i) & "," Next s = s & d e.DataRow("第二列") = s End IfEnd If |
-- 作者:mygoldbird -- 发布时间:2021/4/6 14:48:00 -- 非常感谢,已了解,正在认真学习中! 再次感谢!
|