第1个回答 2016-03-21
窗体只需要添加2个文本框,一个按钮就可以了
然后编辑按钮单击事件代码:
private sub command1_click()
dim x(1 to 4) as single
dim i as integer
dim s,p as single
s=0
for i=1 to 4
x(i)=val(inputbox("请分别输入四个数"))
next i
for i=1 to 4
s=s+x(i)
next i
p=s/4
text2.value=s
text3.value=p
end sub
这里command1为按钮名称
text2、text3为文本框名称
s为和
p为平均值本回答被提问者和网友采纳