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 Select Case n Case Is < 40: n = n * 2.2 + 30 Case 40 To 100: n = n * 3 + 30 Case Is > 100: n = n * 3.5 + 30 End Select Print #2, n Close Close End End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\out.txt" For Output As #2
Open App.Path & "\in.txt" For Input As #1
Input #1, x
Select Case x
Case Is < 40: Print #2, x * 2.2 + 30
Case 40 To 100: Print #2, x * 3 + 30
Case Is > 100: Print #2, x * 3.5 + 30
End Select
Close #1
Close #2
End
End Sub
Private Sub Form_Activate()
回覆刪除me.hide
Open App.Path & "\in.txt" For Input As #1
Input #1, x
Close #1
Select Case x
Case Is < 40
ans = 30 + x * 2.2
Case 40 To 100
ans = 30 + x * 3
Case Is > 100
ans = 30 + x * 3.5
End Select
Open App.Path & "\out.txt" For Output As #2
Print #2, ans
Close #2
end
End Sub
//--------------
這題...未免太簡單了吧...
Dim N As Integer
回覆刪除Private Sub Form_Activate()
me.hide
Open App.Path & "\in.txt" For Input As #1
Input #1, N
Close #1
Open App.Path & "\out.txt" For Output As #2
Select Case N
Case Is < 40
Print #2, 30 + N * 2.2
Case 40 To 100
Print #2, 30 + N * 3
Case Is > 100
Print #2, 30 + N * 3.5
End Select
Close #2
end
End Sub
三位好,
回覆刪除是簡單了些,但是,以往的比賽,還真有機會出這樣的送分題的。
三位的程式都正確。 還是要多練手,比賽的時候才不會緊張而出錯。
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
Select Case n
Case Is < 40: n = n * 2.2 + 30
Case 40 To 100: n = n * 3 + 30
Case Is > 100: n = n * 3.5 + 30
End Select
Print #2, n
Close
Close
End
End Sub
1:48