Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim M As Integer
        M = Val(TextBox1.Text)
        If M <= 3 Then
            MsgBox("春天")
        ElseIf M <= 6 Then
            MsgBox("夏天")
        ElseIf M <= 9 Then
            MsgBox("秋天")
        ElseIf M <= 12 Then
            MsgBox("冬天")
        Else
            MsgBox("無解")
            '當我輸入值為1-3時,產生答案為春天
            '當我輸入值為4-6時,產生答案為夏天
            '當我輸入值為7-9時,產生答案為秋天
            '當我輸入值為10-12時,產生答案為冬天
            '因為一年只有12個月份,當我輸入值超過13(含)時,產生答案為無解
        End If
    End Sub
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 台中家商 小柯 的頭像
    台中家商 小柯

    小柯的文章貼簿

    台中家商 小柯 發表在 痞客邦 留言(0) 人氣()