I have created a program to determine if a quadratic equation gives a 'real' number as its answer and if so, what it is. However, this is my first time working with if/else so my program won't compile past the else and, after searching for half an hour I'm no closer to finding out why
Code is as follows:
program Quadratic_Equation_Solver;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, CustApp;
var
a, b, c : real;
begin
writeln('Insert the Value for a please');
readln(a);
writeln('Insert the Value for b please');
readln(b);
writeln('Insert the Value for c please');
readln(c);
if (-4*a*c<b*b) then
writeln('These variables return an imaginary quantity that');
writeln('Cannot be computed. Please try again');
readln;
(*here it breaks*) else
Writeln('The Answer is x = ',(-b+sqrt((b*b)-(4*a*c))/(2*a)):8:2);
readln;
end.
At the break it says it needs a semi-colon but that hasn't worked
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…