Page 125 -
P. 125

附錄四:11900 電腦軟體設計丙級學科題庫(105 年新版)

【程式碼-改成 Do While … Loop 前測式-迴圈】

Dim x, y, z As Long
FileOpen(1, "c:\丙設磁片\940301.sm", OpenMode.Input)
Input(1, x)
FileClose(1)
z=x
_______________
_______________

      y = y & (x Mod 10)
      x = x \ 10
      If x = 0 Then Exit For
_______________
_______________
If z = y Then
      t01.Text = "第一題結果:" & z & " is a palindrome."
Else
      t01.Text = "第一題結果:" & z & " is not a palindrome."
End If

【程式碼-改成 Do … Loop While 後測式-迴圈】

Dim x, y, z As Long
FileOpen(1, "c:\丙設磁片\940301.sm", OpenMode.Input)
Input(1, x)
FileClose(1)
z=x
_______________
_______________

      y = y & (x Mod 10)
      x = x \ 10
      If x = 0 Then Exit For
_______________
_______________
If z = y Then
      t01.Text = "第一題結果:" & z & " is a palindrome."
Else
      t01.Text = "第一題結果:" & z & " is not a palindrome."
End If

                                                          121
   120   121   122   123   124   125   126   127   128   129   130