悬赏:请帮我解决几道VB遍程题

来源:百度知道 编辑:UC知道 时间:2024/09/25 11:17:16
1.编程计算分段函数y=3n+2 n<0 0 n=0 2n-1 n>0
2.编写程序将任意输入的3个数字按照从小到大的顺序输出.
3.输入20个数字,显示其中奇数的个数和偶数的个数.
4.编程对任意3个三角形边长数,判断它们是否构成一个三角形,如果能构成三角形,输出三角形的面积.
希望能有详细的解答过程.谢谢.

1.
Private Function GetValue(ByVal N As Integer) As Integer

Dim Result As Integer = 0

If N < 0 Then

Result = 3 * N + 2

ElseIf N = 0 Then

Result = 0

Else

Result = 2 * N - 1

End If

End Function

Private Function Compare(ByVal L As Integer, ByVal M As Integer, ByVal N As Integer) As Integer

If (L > M) And (M > N) Then

MsgBox(N)

MsgBox(M)

MsgBox(L)

ElseIf (L > M) And (M <= N) Then

MsgBox(M)

MsgBox(N)

MsgBox(L)

End If
........以此类推

the last one the same as the second one