窗体上有TEXT1、text2两个文框及一个命令按钮command1,编写下列程序:
dimyasintegerprivatesubcommand1_click()dimxasintegerx=2text1.text=p2(p1(x),y):text2.t...
dim y as integer
private sub command1_click()
dim x as integer
x=2
text1.text=p2(p1(x),y):text2.text=p1(x)
end sub
private function P1(x as integer)as integer
x=x+y:y=x+y
p1=x+y
end function
private function p2 (x as integer,y as integer)as integer
p2=2*x+y
end function
程序运行后,第一次单击和第二次单击命令按钮后,文本框Text1和Text2内的值分别是( ) 展开
private sub command1_click()
dim x as integer
x=2
text1.text=p2(p1(x),y):text2.text=p1(x)
end sub
private function P1(x as integer)as integer
x=x+y:y=x+y
p1=x+y
end function
private function p2 (x as integer,y as integer)as integer
p2=2*x+y
end function
程序运行后,第一次单击和第二次单击命令按钮后,文本框Text1和Text2内的值分别是( ) 展开
1个回答
展开全部
第一次单击:10
第二次单击:58
第二次单击:58
追问
请问 能具体说下过程吗
追答
' 第一次点击 第二次点击
Dim y As Integer y=0 y=6
Private Sub command1_click()
Dim x As Integer
x = 2 x=2 x=2
Text1.Text = p2(P1(x), y) P1(2)=4,y=2,p2(4, 2)=10 P1(2)=22,y=14,p2(22, 14)=48
Text2.Text = P1(x) P1(2)=10, y=6 P1(8)=58, y=36
End Sub
Private Function P1(x As Integer) As Integer
x = x + y: y = x + y x=2, y=2 x=8, y=14
P1 = x + y P1=4 P1=22
End Function
Private Function p2(x As Integer, y As Integer) As Integer
p2 = 2 * x + y P2=2*4+2=10 P2=2*22+14=58
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询