问题:假设有二个数 a=123.456789 b=987.65432
第一步得实现让a保留小数点后四位
第二步再让b保留小数点后四位
第三步再把a和b保留后的数加起来.
注意不能让a和b在不保留小数点后四位下就相加

解决方案 »

  1.   

    Private Sub Command2_Click()
    Dim a, b, c, d, ea = 123.456789
    b = 987.65432
    c = Format(a, "0.0000")
    d = Format(b, "0.0000")
    MsgBox c
    MsgBox d
    e = a + b
    MsgBox Format(e, "0.0000")End Sub
      

  2.   

    c=format(a,"000.0000")+format(b,"000.0000")
      

  3.   

    \注意不能让a和b在不保留小数点后四位下就相加\\把e = a + b改为e = c + d就行了