一道pascal的题,做出来了,但就是显示错误。希望有大神指点一下
pascal吧
全部回复
仅看楼主
level 2
题目:求方程的解(简化版)
输入a、b、c求一元二次方程ax^2+bx+c=0的两个实数根(不考虑无解的情况)。
输入:一行,为a,b,c,每个数用空格隔开。
输出:共一行,两个方程的解用一个空格隔开,保留2位小数,先输出较大的解,若两个解相等时也要输出两个相等的数。
var
a,b,c,d,e:integer;
begin
read(a,b,c);
d:=(-b+sqrt(b*b-4*a*c))/2a;
e:=(-b-sqrt(b*b-4*a*c))/2a;
write(d:0:2,' ',e:0:2);
end.
错误显示:
Free Pascal Compiler version 2.6.4+dfsg-4 [2014/10/14] for x86_64
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling Main.pas
Main.pas(5,24) Error: Incompatible types: got "Extended" expected "SmallInt"
Main.pas(5,26) Fatal: Syntax error, ";" expected but "identifier A" found
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)
2016年07月07日 11点07分 1
level 12
integer?
2016年07月07日 23点07分 3
level 10
求根公式一用,就不能用整型了,把de改成real。
2016年07月08日 13点07分 4
level 1
定义real
2016年07月09日 10点07分 5
level 5
用REAL换掉integer
2016年07月27日 12点07分 6
1