knrt.net
当前位置:首页 >> 随机产生一个3位正整数,然后逆序输出,产生的随机数... >>

随机产生一个3位正整数,然后逆序输出,产生的随机数...

Dim sum, a, b, c As Integer, m As Single Private Sub Cmd1_Click() Randomize m = Int(Rnd * 900 + 100) Print m a = m \ 100 b = (m Mod 100) \ 10 c = m Mod 10 sum = c * 100 + b * 10 + a Print sum End Sub 呵呵,我试过了,可以!

Private Sub Form_Click() Randomize Dim A As Integer Dim B As Long A = Int(Rnd * 900 + 100) B = NiXuShu(A) Print A; vbTab; B End Sub Private Function NiXuShu(ByVal l As String) As Long '逆序数计算 Dim i As Integer, j As Integer,...

数字逆序法: Private Sub Form_Click()Dim x As IntegerDim n1 As Integer, n2 As Integer, n3 As IntegerRandomizex = Int(Rnd * 900) + 100n1 = x \ 100n2 = (x Mod 100) \ 10n3 = x Mod 10Print x, n3 * 100 + n2 * 10 + n1End Sub字符串逆...

VBA编程实现不重复随机数输出。VBA里的随机函数是RND,在工作表中随机函数是RAND,一字之差,可要记好了。RND取值范围是[0,1),意思是0和1之间的一个随机数,包含0,但不包含1。 1、用法 语法:Rnd[(number)]如果 number 的值是 Randomize 生成...

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com