Dim n As Integer, ans Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n
If n Mod 2 <> 0 Then n = n - 1 ans = n / 2 Print #2, ans
Private Sub Form_Load() Dim N As Integer Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Do While Not EOF(1) Input #1, N
If N = 1 Then Print #2, 1 Else Print #2, N \ 2 End If
Dim n As Integer, ans
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
If n Mod 2 <> 0 Then n = n - 1
ans = n / 2
Print #2, ans
Close
Close
End
End Sub
不知道有沒有錯
Private Sub Form_Load()
回覆刪除Dim N As Integer
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do While Not EOF(1)
Input #1, N
If N = 1 Then
Print #2, 1
Else
Print #2, N \ 2
End If
Loop
Close #2
Close #1
End
End Sub
in.txt--------------------
1
2
3
4
5
6
7
8
9
32767
out.txt--------------------
1
1
1
2
2
3
3
4
4
16383