vb题目 设计程序,能生成一个六位数,然后倒排序输出。

来源:百度知道 编辑:UC知道 时间:2024/06/23 08:14:19
VB题目,五个小时内需要答案,谢谢!!

sub makeandchange()
for i = 1 to 6
str=str=str(int(rnd*9))
next i
print str
'以下是倒序
for i = 6 to 1 step-1
str1=str1+mid(str,i,1)
next i
print str1

Sub M()
Range("A1").Select
ActiveCell.FormulaR1C1 = "=ROUND(RAND()*1000000,)"
Range("A2").Select
Range("B1").Select
ActiveCell.FormulaR1C1 = _
"=SUMPRODUCT(MID(RC[-1],ROW(INDIRECT(""1:""&LEN(RC[-1]))),1)*10^(ROW(INDIRECT(""1:""&LEN(RC[-1])))-1))"
Range("A1").Select

End Sub

Private Sub Command1_Click()
Randomize
Dim a, b As String
a = Int((999999 - 100000 + 1) * Rnd + 100000)
b = StrReverse(a)
MsgBox "随机六位数:" & a & " 倒序后为:" & b
End Sub