大家好,我是 我还在为此工作。我有几个问题。我开始了解更多。我不明白,唯一的问题是这样的......函数和写入程序
从主程序调用哪个计算 并返回该 “斜边”等于平方根(x的平方 值的 功能程序+ y平方)。您将 必须将x和y的值传递给 此函数过程。 程序应计算并返回 一个双重类型的值。该功能程序 返回的值 应该等于 (x平方+ y平方)的平方根。也从 主程序调用子程序到 显示x,y和斜边的值。
这只是通过我。这里是我到目前为止。现在我会在x中声明这个,还是应该把x和y放在一起?
Option Strict On
Option Explicit On
Module Module1
Sub Main()
Dim x As Double = width()
Dim y As Double = height(x)
Console.Read()
End Sub
Private Function width() As Double
Dim x As Double
x = Convert.ToDouble(Console.ReadLine())
Return x
End Function
Private Function height(ByVal x As Double) As Double
Dim y As Double
y = Convert.ToDouble(Console.ReadLine())
Return y
End Function
Private Sub hypotenuse(ByVal x As Double, ByVal y As Double)
y = Math.Sqrt(x squared + y squared)
Console.WriteLine(x & " X = " & y & " Y")
End Sub
End Module