发布网友 发布时间:2024-10-22 04:36
共3个回答
热心网友 时间:2024-11-08 19:31
dim sumA as double
dim sumB as double
sub A()
dim InputNum as double
dim i as integer
for i= 1 to val(text1)
InputNum=val(inpubox("输入"))
labelA.caption=labelA.caption & InputNum & vbcrlf
sumA=sumA+InputNum
end sub
sub B()
dim InputNum as double
dim i as integer
for i= 1 to val(text2)
InputNum=val(inpubox("输入"))
labelB.caption=labelABcaption & InputNum & vbcrlf
sumB=sumB+InputNum
end sub
sub C()
labelC.caption="A中之和:" & sumA & vbcrlf & "B中之和:" & sumA
左边的label.caption=abs(sumA-sumB)
end sub
private sub cmdA_click()
A
end sub
private sub cmdB_click()
B
end sub
private sub cmdC_click()
C
end sub
纯手写,调试下
热心网友 时间:2024-11-08 19:31
你是要代码还是要设计方法?
热心网友 时间:2024-11-08 19:32
dim i as integer
private sub cmdA_click()
for i = 1 to val(text1.text)
labelA.caption = inputbox("请输入") & " "
next
end sub
private sub cmdB_click()
for i = 1 to val(text2.text)
labelB.caption = inputbox("请输入") & " "
next
end sub
private sub cmdC_click()
dim a() as integer
a = split(labelA.caption," ")
for i = 0 to ubound(a)
c = c + a(i)
next
b = split(labelB.caption," ")
for i = 0 to uboubd(b)
d = d + b(i)
next
label.caption = abs(c - d)
end sub