I have a program that checks OK but when I go to run it, all I get is an orange circle with a bang (exclamation point) in it. I can't even run the debugger without getting the bang. How am I supposed to debug
Code:
#cas
Testpass():=
BEGIN
circl();
dett();
x:=1; y:=2;
c:=makemat(0,2);
p:=makemat(0,3,2);
temp:="";
p(1,x) := 7;
p(1,y) := 7;
p(2,x) := 0;
p(2,y) := 8;
p(3,x) := 0;
p(3,y) := 0;
print();
temp := "points: ";
temp := temp + "("+ p(1,x)+ ", "+ p(1,y)+ "), ";
temp := temp + "("+ p(2,x)+ ", "+ p(2,y)+ "), ";
print (temp+"("+ p(3,x)+ ", "+ p(3,y)+ ") ");
r := circl( c, p );
if r > 0 then
print ("Circle: ("+ c(x)+ ", "+ c(y)+ "), "+ r);
else
print ("Not a circle!");
end;
END;
//
// Calculate center and radius of
// circle given three points
//
circl( c, p )
begin
local x:=1, y:=2;
local i;
local r, m11, m12, m13, m14;
local a:=makemat(0,3,3);
for i := 1 to 3 do // find minor 11
a(i,1) := p(i,x);
a(i,2) := p(i,y);
a(i,3) := 1;
end;
m11 := dett( a, 3 );
for i := 1 to 3 do // find minor 12
a(i,1) := p(i,x)^2 + p(i,y)^2;
a(i,2) := p(i,y);
a(i,3) := 1;
end;
m12 := dett( a, 3 );
for i := 1 to 3 do // find minor 13
a(i,1) := p(i,x)^2 + p(i,y)^2;
a(i,2) := p(i,x);
a(i,3) := 1;
end;
m13 := dett( a, 3 );
for i := 1 to 3 do // find minor 14
a(i,1) := p(i,x)^2 + p(i,y)^2;
a(i,2) := p(i,x);
a(i,3) := p(i,y);
end;
m14 := dett( a, 3 );
if m11 = 0 then
r := 0; // not a circle
else
c(x) =< 0.5 * m12 / m11; // center of circle
c(y) =< -0.5 * m13 / m11;
r := sqrt( c(x)^2 + c(y)^2 + m14/m11 );
end;
return r; // the radius
end;
//
// Calculate determinate using recursive
// expansion by minors.
//
dett( a, n )
begin
local i, j, j1, j2;
local d := 0;
local m := makemat(0,3,3);
// assert n > 1
if n = 2 then
d := a(1,1)*a(2,2) - a(2,1)*a(1,2);
else
d := 0;
for j1 := 1 to n do
// create minor
for i := 2 to n do
j2 := 1;
for j := 1 to n do
if j <> j1 then
m(i-1,j2) := a(i,j);
j2 := j2 + 1;
end;
end;
end;
// calculate determinant
d := d + ( -1.0 )^(1 + j1 ) * a(1,j1) * dett( m, n-1 );
end;
end;
return d;
end;
#end