1.倒轉程式
EX:輸入ABC..輸出CBA
2.終極密碼..由電腦取出1ㄍ亂數>>>Int(Rnd() * 100 + 1)
再來..我們猜數字..用inputbox...
2005-06-17 18:49:56 · 2 個解答 · 發問者 pure 2 in 電腦與網際網路 ➔ 程式設計
1.倒轉程式:
Dim rst, wst As String 'rst存放原始字串,wst存放轉換後的字串
rst = InputBox("請輸入一字串", "輸入視窗")
For i = 0 To Len(rst) - 1
wst = wst + Mid(rst, Len(rst) - i, 1)
Next i
MsgBox "轉換結果" & wst, , "訊息視窗"
Unload Me
2.終極密碼:
Dim ans, gest, l, h As Integer
Randomize
ans = Int(Rnd() * 100 + 1)
l = 0
h = 100
Do While (1)
gest = InputBox("請輸入" & l & "~" & h & "的數字", "終極密碼")
If Val(gest) = ans Then
MsgBox "你猜對了,答案是:" & ans, , "訊息視窗"
Exit Do
ElseIf Val(gest) > ans Then
h = gest
Else
l = gest
End If
Loop
Unload Me
2005-06-17 19:33:00 · answer #1 · answered by 上官 5 · 0⤊ 0⤋
第一題可用字串反轉函數
MyStr=InputBox("輸入一字串")
MsgBox StrReverse(MyStr)
2005-06-17 20:58:07 · answer #2 · answered by ? 6 · 0⤊ 0⤋