首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

运算溢出

2012-04-08 
求助 运算溢出PrivateSubcmd_avg_Click()DimA(1To10)AsIntegerDimiAsInteger,sumAsIntegerDimavgAsInteger

求助 运算溢出
Private   Sub   cmd_avg_Click()
  Dim   A(1   To   10)   As   Integer
  Dim   i   As   Integer,   sum   As   Integer
  Dim   avg   As   Integer
  Refresh_Scores
 
  i   =   0
    Do   While   Adodc1.Recordset.EOF   =   True
          i   =   i   +   1
          A(i)   =   Adodc1.Recordset( "考试成绩 ")
          sum   =   sum   +   A(i)
          Adodc1.Recordset.MoveNext
    Loop
    avg   =   Int(sum   /   i)
Text1.Text   =   Trim(Str(avg))
End   Sub


运算后显示“avg   =   Int(sum   /   i)”溢出


[解决办法]
Dim i As Long, sum As Long
Dim avg As Long

热点排行