06.08.2013 Views

03 林家民

03 林家民

03 林家民

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

題目說明:反向輸出字串中的字元<br />

檔案名稱:<strong>03</strong> \ ch6 \ P.194<br />

表單:<br />

程式碼:<br />

Private Sub Form_Activate()<br />

Dim i As Integer, word As String, reword As String<br />

word = InputBox("請輸入任意字串", "字串反轉")<br />

i = Len(word)<br />

Do While i >= 1<br />

reword = reword + Mid(word, i, 1)<br />

i = i - 1<br />

Loop<br />

MsgBox word & "反轉後為" & reword, , "字串反轉"<br />

End Sub<br />

執行結果:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!