none
程序标识符改错 RRS feed

  • 问题

  • Public Class Form1
        Function gcd(ByVal m, ByVal n) As Integer
            Dim r, t As Integer
            If m < n Then t = m : m = n : n = t
            r = m Mod n
            Do While (r <> 0)
                m = n : n = r : r = m Mod n
            Loop
            gcd = n
        End Function
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim m, n As Integer
            m = Val(TextBox1.Text)
            n = Val(TextBox2.Text)
            TextBox3.Text &=  gcd (   Space(10 - Len(m,n ," )"   .
            TextBox3.Text &= vbCrLf
        End Sub
    End Class
    2010年11月23日 14:58

答案

  • 您好

    您的問題是什麼? 錯誤在哪一行?

    Public Class Form1
      Function gcd(ByVal m, ByVal n) As Integer
        Dim r, t As Integer
        If m < n Then t = m : m = n : n = t
        r = m Mod n
        Do While (r <> 0)
          m = n : n = r : r = m Mod n
        Loop
        gcd = n
      End Function
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim m, n As Integer
        m = Val(TextBox1.Text)
        n = Val(TextBox2.Text)
        TextBox3.Text &= gcd(m, n) ' 改成這樣
        TextBox3.Text &= vbCrLf
      End Sub
    End Class
    
    

    歡迎參觀我的Blog.NET菜鳥自救會
    2010年11月24日 2:08