
请问这道VB题怎么做?
已知m=max(a,b,c)/(max(a+b,b,c)*max(a,b,b+c)),其中max(a,b,c)为求a,b,c这三个数最大值的函数,编写程序,输入a,b,c...
已知m=max(a,b,c)/(max(a+b,b,c)*max(a,b,b+c)),其中max(a,b,c)为求a,b,c这三个数最大值的函数,编写程序,输入a,b,c的值,求m的值。用子过程调用
Function max(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End Function
就是要把这段函数过程编成子过程的~~!! 展开
Function max(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End Function
就是要把这段函数过程编成子过程的~~!! 展开
7个回答
展开全部
Function max(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End Function
Private Sub Command1_Click()
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
=========================
dim max as integer
sub Testmax(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer)
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End sub
Private Sub Command1_Click()
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
call testmax
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End Function
Private Sub Command1_Click()
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
=========================
dim max as integer
sub Testmax(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer)
If a > b Then
If a > c Then
max = a
Else
max = c
End If
Else
If b > c Then
max = b
Else
max = c
End If
End If
End sub
Private Sub Command1_Click()
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
call testmax
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
展开全部
你的function代码没问题,但是要稍稍改一下:
1. Function max(ByVal a As Double, ByVal b As Double, ByVal c As Double)As Double
2. 在End Function 上面加一句Return c
再把如下代码放入按钮:
Dim a, b, c, m As Double
a = CDbl(TextBox1.Text)
b = CDbl(TextBox2.Text)
c = CDbl(TextBox3.Text)
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Label1.Text = m.ToString()或者Print m
1. Function max(ByVal a As Double, ByVal b As Double, ByVal c As Double)As Double
2. 在End Function 上面加一句Return c
再把如下代码放入按钮:
Dim a, b, c, m As Double
a = CDbl(TextBox1.Text)
b = CDbl(TextBox2.Text)
c = CDbl(TextBox3.Text)
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Label1.Text = m.ToString()或者Print m
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
a = Val(InputBox(""))
b = Val(InputBox(""))
c = Val(InputBox(""))
m = max(a, b, c) / (max(a + b, b, c) * max(a, b, b + c))
Print m
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
当前窗口高度等于当前窗口高度+1000。你想干?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
直接在窗体双输入以下代码就可以了。
Private
Sub
Command1_Click()
Me.Height
=
Me.Height
+
1000
Me.Width
=
Me.Width
+
1000
Me.Left
=
Me.Left
-
500
Me.Top
=
Me.Top
-
500
End
Sub
Private
Sub
Command1_KeyDown(KeyCode
As
Integer,
Shift
As
Integer)
If
KeyCode
=
27
Then
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
If
End
Sub
Private
Sub
Command2_Click()
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
Sub
Private
Sub
Command2_KeyDown(KeyCode
As
Integer,
Shift
As
Integer)
If
KeyCode
=
27
Then
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
If
End
Sub
Private
Sub
Command1_Click()
Me.Height
=
Me.Height
+
1000
Me.Width
=
Me.Width
+
1000
Me.Left
=
Me.Left
-
500
Me.Top
=
Me.Top
-
500
End
Sub
Private
Sub
Command1_KeyDown(KeyCode
As
Integer,
Shift
As
Integer)
If
KeyCode
=
27
Then
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
If
End
Sub
Private
Sub
Command2_Click()
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
Sub
Private
Sub
Command2_KeyDown(KeyCode
As
Integer,
Shift
As
Integer)
If
KeyCode
=
27
Then
Me.Height
=
Me.Height
-
1000
Me.Width
=
Me.Width
-
1000
Me.Top
=
Me.Top
+
500
Me.Left
=
Me.Left
+
500
End
If
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private
Sub
Command1_Click(Index
As
Integer)
SetWH
Me,
1000,
CBool(Index)
End
Sub
Private
Sub
Command1_KeyPress(Index
As
Integer,
KeyAscii
As
Integer)
If
KeyAscii
=
27
Then
SetWH
Me,
1000,
True
If
KeyAscii
=
13
Then
SetWH
Me,
1000,
False
End
Sub
Private
Sub
SetWH(Frm
As
Form,
Wid
As
Long,
SumB
As
Boolean)
Select
Case
SumB
Case
False
'放大
Frm.Width
=
Frm.Width
+
Wid
Frm.Height
=
Frm.Height
+
Wid
Case
True
'缩小
Frm.Width
=
Frm.Width
-
Wid
Frm.Height
=
Frm.Height
-
Wid
End
Select
Frm.Top
=
(Screen.Height
-
Frm.Height)
/
2
Frm.Left
=
(Screen.Width
-
Frm.Width)
/
2
Frm.SetFocus
End
Sub
Private
Sub
Form_Load()
Me.StartUpPosition
=
2
End
Sub
Sub
Command1_Click(Index
As
Integer)
SetWH
Me,
1000,
CBool(Index)
End
Sub
Private
Sub
Command1_KeyPress(Index
As
Integer,
KeyAscii
As
Integer)
If
KeyAscii
=
27
Then
SetWH
Me,
1000,
True
If
KeyAscii
=
13
Then
SetWH
Me,
1000,
False
End
Sub
Private
Sub
SetWH(Frm
As
Form,
Wid
As
Long,
SumB
As
Boolean)
Select
Case
SumB
Case
False
'放大
Frm.Width
=
Frm.Width
+
Wid
Frm.Height
=
Frm.Height
+
Wid
Case
True
'缩小
Frm.Width
=
Frm.Width
-
Wid
Frm.Height
=
Frm.Height
-
Wid
End
Select
Frm.Top
=
(Screen.Height
-
Frm.Height)
/
2
Frm.Left
=
(Screen.Width
-
Frm.Width)
/
2
Frm.SetFocus
End
Sub
Private
Sub
Form_Load()
Me.StartUpPosition
=
2
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询