Private Sub Form_Load() Me.Hide Dim n As Integer Open App.Path & "/in.txt" For Input As #1 Open App.Path & "/out.txt" For Output As #2 Input #1, x n = 30 If x < 40 Then n = n + x * 2.2 If 40 < x < 100 Then n = n + x * 3 If x > 100 Then n = n + x * 3.5
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, M If M < 40 Then X = M * 2.2 + 30 If (M >= 40) And (M < 100) Then X = M * 3 + 30 If M >= 100 Then X = M * 3.5 + 30 Print #2, X Close #2 Close #1 End End Sub
Private Sub Form_Load() Me.Hide Dim n As Integer Open App.Path & "/in.txt" For Input As #1 Open App.Path & "/out.txt" For Output As #2 Input #1, x n = 30 If x < 40 Then n = n + x * 2.2 If (40 <= x) And (x < 100) Then n = n + x * 3 If x >= 100 Then n = n + x * 3.5
Private Sub Form_Load() Dim y As Integer Open App.Path & "\in.txt" For Input As 1 Open App.Path & "\out.txt" For Output As 2 Input #1, x If 40 < x <= 100 Then y = x * 3 + 30 End If If 40 >= x Then y = x * 2.2 + 30 End If If x > 100 Then y = x * 3.5 + 30 End If
Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x If x < 40 Then m = 30 + x * 2.2 If (x >= 40) And (x < 100) Then m = 30 + x * 3 If (x >= 100) Then m = 30 + x * 3.5 Print #2, m Close Close End
Private Sub Form_Load()
回覆刪除Me.Hide
Dim n As Integer
Open App.Path & "/in.txt" For Input As #1
Open App.Path & "/out.txt" For Output As #2
Input #1, x
n = 30
If x < 40 Then n = n + x * 2.2
If 40 < x < 100 Then n = n + x * 3
If x > 100 Then n = n + x * 3.5
Print #2, n
Close
Close
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, M
If M < 40 Then X = M * 2.2 + 30
If (M >= 40) And (M < 100) Then X = M * 3 + 30
If M >= 100 Then X = M * 3.5 + 30
Print #2, X
Close #2
Close #1
End
End Sub
晟晟程式正確。
回覆刪除小冰,你的 40 < x < 100 是錯誤語法
要像晟晟那樣才是正確的
Private Sub Form_Load()
回覆刪除Me.Hide
Dim n As Integer
Open App.Path & "/in.txt" For Input As #1
Open App.Path & "/out.txt" For Output As #2
Input #1, x
n = 30
If x < 40 Then n = n + x * 2.2
If (40 <= x) And (x < 100) Then n = n + x * 3
If x >= 100 Then n = n + x * 3.5
Print #2, n
Close
Close
End
End Sub
Private Sub Form_Load()
回覆刪除Dim y As Integer
Open App.Path & "\in.txt" For Input As 1
Open App.Path & "\out.txt" For Output As 2
Input #1, x
If 40 < x <= 100 Then
y = x * 3 + 30
End If
If 40 >= x Then
y = x * 2.2 + 30
End If
If x > 100 Then
y = x * 3.5 + 30
End If
Print #2, y
Close
Close
End
End Sub
小冰程式對了。
回覆刪除哲哲跟小冰一開始一樣
40 < x <= 100
這樣不算是很正確的語法
要改成像晟晟那樣
然後題目要看清楚
※用電在40度之內,40度至100度,超過100度
作者已經移除這則留言。
回覆刪除Dim a As Integer
回覆刪除Dim x As Integer
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, a
x = 30
If a < 40 Then
x = x + a * 2.2
End If
If (a > 40 And a < 100) Then
x = x + a * 3
End If
If a > 100 Then
x = x + a * 3.5
End If
Print #2, x
End
End Sub
Me.Hide
回覆刪除Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
If x < 40 Then m = 30 + x * 2.2
If (x >= 40) And (x < 100) Then m = 30 + x * 3
If (x >= 100) Then m = 30 + x * 3.5
Print #2, m
Close
Close
End