字體:小 中 大 |
|
|
|
| 2009/11/09 18:27:01瀏覽541|回應0|推薦0 | |
| Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num1, num, cc As Integer Dim new1 As String FileOpen(1, "C:/940301.sm", OpenMode.Input) Input(1, num1) num = num1 new1 = "" For i = 1 To 9 cc = num Mod 10 new1 = new1 & cc num = num \ 10 If num = 0 Then Exit For Next If new1 = num1 Then TextBox1.Text = num1 & "是迴文" Else TextBox1.Text = num1 & "不是迴文" End If FileClose() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim abc As Integer FileOpen(1, "C:/940302.sm", OpenMode.Input) Input(1, abc) For i = 1 To abc For j = 1 To i TextBox2.Text = TextBox2.Text & j Next TextBox2.Text = TextBox2.Text & vbCrLf Next FileClose() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim aaa As Integer Dim ff As Boolean FileOpen(1, "C:/940303.sm", OpenMode.Input) Input(1, aaa) ff = True For i = 2 To aaa - 1 If (aaa Mod i = 0) Then ff = False End If Next If ff = False Then TextBox3.Text = aaa & "不是質數" Else TextBox3.Text = aaa & "是質數" End If FileClose() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim hh, ww, bmi, small As Integer small = 100 FileOpen(1, "C:/940304.sm", OpenMode.Input) For i = 1 To 3 Input(1, hh) Input(1, ww) bmi = ww / (hh / 100) ^ 2 If bmi < small Then small = bmi Next If (small < 20) Or (small > 25) Then TextBox4.Text = "最小值為" & small & ",不正常" Else TextBox4.Text = "最小值為" & small & ",正常" End If FileClose() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim a(2, 2), b(2, 2), c(2, 2), i, j As Integer FileOpen(1, "C:/940305.sm", OpenMode.Input) Input(1, a(1, 1)) Input(1, a(1, 2)) Input(1, a(2, 1)) Input(1, a(2, 2)) Input(1, b(1, 1)) Input(1, b(1, 2)) Input(1, b(2, 1)) Input(1, b(2, 2)) For i = 1 To 2 TextBox5.Text = TextBox5.Text & "[ " For j = 1 To 2 c(i, j) = a(i, j) + b(i, j) TextBox5.Text = TextBox5.Text & c(i, j) & " " Next TextBox5.Text = TextBox5.Text & " ]" & vbCrLf Next FileClose() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Dim num1, num, cc, i As Integer Dim new1 As String FileOpen(1, "C:/940301.sm", OpenMode.Input) Input(1, num1) num = num1 new1 = "" i = 1 Do While i <= 9 cc = num Mod 10 new1 = new1 & cc num = num \ 10 If num = 0 Then Exit Do i = i + 1 Loop If new1 = num1 Then TextBox6.Text = num1 & "是迴文" Else TextBox6.Text = num1 & "不是迴文" End If FileClose() End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click Dim num1, num, cc As Integer Dim new1 As String FileOpen(1, "C:/940301.sm", OpenMode.Input) Input(1, num1) num = num1 new1 = "" For i = 1 To 9 cc = num Mod 10 new1 = new1 & cc num = num \ 10 If num = 0 Then Exit For Next If new1 = num1 Then TextBox11.Text = num1 & "是迴文" Else TextBox11.Text = num1 & "不是迴文" End If FileClose() End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dim abc, i, j As Integer FileOpen(1, "C:/940302.sm", OpenMode.Input) Input(1, abc) i = 1 Do While i <= abc j = 1 Do While j <= i TextBox7.Text = TextBox7.Text & j j = j + 1 Loop TextBox7.Text = TextBox7.Text & vbCrLf i = i + 1 Loop FileClose() End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click Dim abc, i, j As Integer FileOpen(1, "C:/940302.sm", OpenMode.Input) Input(1, abc) i = 1 Do j = 1 Do TextBox12.Text = TextBox12.Text & j j = j + 1 Loop While j <= i TextBox12.Text = TextBox12.Text & vbCrLf i = i + 1 Loop While (i <= abc) FileClose() End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Dim aaa, i As Integer Dim ff As Boolean FileOpen(1, "C:/940303.sm", OpenMode.Input) Input(1, aaa) ff = True i = 1 Do While i <= 2 If (aaa Mod i = 0) Then ff = False End If i = i + 1 Loop If ff = False Then TextBox8.Text = aaa & "不是質數" Else TextBox8.Text = aaa & "是質數" End If FileClose() End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click Dim hh, ww, bmi, small, i As Integer small = 100 FileOpen(1, "C:/940304.sm", OpenMode.Input) i = 1 Do While i <= 3 Input(1, hh) Input(1, ww) bmi = ww / (hh / 100) ^ 2 If bmi < small Then small = bmi i = i + 1 Loop If (small < 20) Or (small > 25) Then TextBox9.Text = "最小值為" & small & ",不正常" Else TextBox9.Text = "最小值為" & small & ",正常" End If FileClose() End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click Dim a(2, 2), b(2, 2), c(2, 2), i, j As Integer FileOpen(1, "C:/940305.sm", OpenMode.Input) Input(1, a(1, 1)) Input(1, a(1, 2)) Input(1, a(2, 1)) Input(1, a(2, 2)) Input(1, b(1, 1)) Input(1, b(1, 2)) Input(1, b(2, 1)) Input(1, b(2, 2)) i = 1 Do While i <= 2 TextBox10.Text = TextBox10.Text & "[ " j = 1 Do While j <= 2 c(i, j) = a(i, j) + b(i, j) TextBox10.Text = TextBox10.Text & c(i, j) & " " j = j + 1 Loop TextBox10.Text = TextBox10.Text & " ]" & vbCrLf i = i + 1 Loop FileClose() End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click Dim aaa, i As Integer Dim ff As Boolean FileOpen(1, "C:/940303.sm", OpenMode.Input) Input(1, aaa) ff = True i = 1 Do If (aaa Mod i = 0) Then ff = False End If i = i + 1 Loop While i <= 2 If ff = False Then TextBox13.Text = aaa & "不是質數" Else TextBox13.Text = aaa & "是質數" End If FileClose() End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click Dim hh, ww, bmi, small, i As Integer small = 100 FileOpen(1, "C:/940304.sm", OpenMode.Input) i = 1 Do Input(1, hh) Input(1, ww) bmi = ww / (hh / 100) ^ 2 If bmi < small Then small = bmi i = i + 1 Loop While i <= 3 If (small < 20) Or (small > 25) Then TextBox14.Text = "最小值為" & small & ",不正常" Else TextBox14.Text = "最小值為" & small & ",正常" End If FileClose() End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click Dim a(2, 2), b(2, 2), c(2, 2), i, j As Integer FileOpen(1, "C:/940305.sm", OpenMode.Input) Input(1, a(1, 1)) Input(1, a(1, 2)) Input(1, a(2, 1)) Input(1, a(2, 2)) Input(1, b(1, 1)) Input(1, b(1, 2)) Input(1, b(2, 1)) Input(1, b(2, 2)) i = 1 Do TextBox15.Text = TextBox15.Text & "[ " j = 1 Do c(i, j) = a(i, j) + b(i, j) TextBox15.Text = TextBox15.Text & c(i, j) & " " j = j + 1 Loop While j <= 2 TextBox15.Text = TextBox15.Text & " ]" & vbCrLf i = i + 1 Loop While i <= 2 FileClose() End Sub End Class |
|
| ( 心情隨筆|心情日記 ) |












