标题:编绎错误: 类型-声明字符与声明的数据类型不符合。请教大仙,错在那里
取消只看楼主
音符2128
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-7-9
结帖率:0
已结贴  问题点数:10 回复次数:1 
编绎错误: 类型-声明字符与声明的数据类型不符合。请教大仙,错在那里
Private Sub Form_Load()
   Dim a As Single, b As Single, c As Single
   Dim d As Single, X1 As Single, X2 As Single
   
   Dim q As Single, p As Single
   
   a = Val(InputBox("请输入参数a的值"))
   b = Val(InputBox("请输入参数b的值"))
   c = Val(InputBox("请输入参数c的值"))
   
   If a = 0 Then
       Print "输入参数不是二次方程!"
   Else
      d = b * b - 4 * a * c
      q = -b / (2 * a)
      If d = 0 Then
           Print " 方程有两个相等实数根!" + Chr(13)
           Print "X1=X2=" & q
      ElseIf d > 0 Then
        X1 = (-b + Sqr(d)) / (2 * a)
        X2 = (-b - Sqr(d)) / (2 * a)
        Print "方程有两个不相等实数根" + Chr(13)
        Print "X1=" & X1
        Print Chr(13)
        Print "X2=" & X2
    Else
        p = Sqr(-d) / (2 * a)
        Print "方程有两个共轭复数根" + Chr(13)
        Print "X1" & q&; "+" & p&; "i"
        Print "X2" & q&; "-" & p&; "i"
           
           End If
   End If
End Sub
2014-07-15 20:34
音符2128
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-7-9
得分:0 
谢谢
2014-07-16 19:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-434078-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.145439 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved