訂正前:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
'B2. 算術運算+檔案
'開檔
FileOpen(1, "B2.in", OpenMode.Input)
'處理
Dim a, b As Integer
Dim ans As String = "商" & " " & "餘數" & vbNewLine
Do Until EOF(1)
Input(1, a) : Input(1, b)
ans &= a \ b & " " & a Mod b & If(EOF(1), "", vbNewLine)
Loop
'關檔
FileClose()
Me.TextBox4.Text = ans
My.Computer.FileSystem.WriteAllText("B2.out", ans, False)
End Sub
訂正後:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
'B2. 算術運算+檔案
'開檔
FileOpen(1, "B2.in", OpenMode.Input)
'處理
Dim a, b As Integer
Dim ans = ""
Do Until EOF(1)
Input(1, a) : Input(1, b)
ans &= a \ b & "," & a Mod b & If(EOF(1), "", vbNewLine)
Loop
'關檔
FileClose()
Me.TextBox4.Text = ans
My.Computer.FileSystem.WriteAllText("B2.out", ans, False)
End Sub