請你設計一個程式,幫助登山者算看看山上的溫度為幾度?
輸入:使用者輸入平地溫度、山的高度(即海拔?公尺),再按下"夏季"或"冬季"按鈕
輸出:?度
公式:夏季海拔高度每上升100公尺氣溫約降低0.6度,而冬季每上升100公尺約降低0.36度。
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim A, B, C As Double
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A - (B * 0.6) / 100
TextBox3.Text = C.ToString
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim A, B, C As Double
A = Val(TextBox1.Text)
B = Val(TextBox2.Text)
C = A - (B * 0.36) / 100
TextBox3.Text = C.ToString
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Close()
End Sub
End Class
沒有留言:
張貼留言