Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Long Dim Sum As Single
f1AsSingle,f2AsSinglea=1b=2'c=3Fori=1To10f1=b/a'f2=c/bf2=(a+b)/bList1.AddItemf1List1....
f1 As Single, f2 As Single
a = 1
b = 2
'c=3
For i = 1 To 10
f1 = b / a
'f2=c/b
f2 = (a + b) / b
List1.AddItem f1
List1.AddItem f2
Sum = Sum + f1 + f2
a = a + b
b = a + b
'c = a + b
Next i
Text1.Text = List1.ListCount
Text2.Text = Sum
Print a; b
End Sub
'为什么用c=a+b代替a+b就会出现溢出??? 展开
a = 1
b = 2
'c=3
For i = 1 To 10
f1 = b / a
'f2=c/b
f2 = (a + b) / b
List1.AddItem f1
List1.AddItem f2
Sum = Sum + f1 + f2
a = a + b
b = a + b
'c = a + b
Next i
Text1.Text = List1.ListCount
Text2.Text = Sum
Print a; b
End Sub
'为什么用c=a+b代替a+b就会出现溢出??? 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询