这是功课。有人能帮我搞清楚我说错了吗?当我给Double时,我一直都会收到错误

时间:2016-05-20 01:12:15

标签: vb.net visual-studio visual-studio-2012

Function quadratic (a As double, b As double, c As double) As Double
    Dim x,y As Double   

    if (a = 0) then
        Console.Writeline("no solution for a = 0")      
    else if 
            ((b * b - 4 * a * c) <0)
            Console.Writeline("no real solutions")          
    else
            x = ((- b + Math.Sqrt(b * b - 4 * a * c)) / ( 2 * a))
            y = ((- b - Math.Sqrt(b * b - 4 * a * c)) / ( 2 * a))

            if (x > y) then
                Console.Writeline(x)
            else 
                Console.Writeline(y)
            End if 
    End if
End Function

1 个答案:

答案 0 :(得分:1)

我不会为你检查你的数学:-)但如果你改变了这个:

ElseIf ((b * b - 4 * a * c) < 0) Then
  Console.Writeline("no real solutions")

对此:

sudo gem install -n /usr/local/bin cocoapods

pod install
pod update

它编译并运行......