when attempting to run this program i get the error:
raised CONSTRAINT_ERROR : bifid.adb:55 index check failed
I'm not really sure where this error is coming from or what it exactly means. The line in question is
End_String := End_String & Get_Character(
S, Ind(Count*(length(Cipher_Text))/2), Ind(Count));
Any help would be greatly appreciated. I'm using Ada 95 and a GNAT compiler.
function Decipher(S : Square; Cipher_Text : Ustring) return Ustring is
type IndArray is array(1..(length(Cipher_Text)*2)) of Integer;
Ind : IndArray;
Temp : Character;
Row : Integer;
Col : Integer;
Count : Integer := 1;
End_String : Ustring;
begin
Ind := (others=>0);
for I in 1..length(Cipher_Text) loop
Temp := Uppercase(Element(Cipher_Text, I));
if In_Square(S, Temp) then
Get_Coordinates(S, Temp, Row, Col);
Ind(I) := row;
Ind(I + length(Cipher_Text)) := Col;
end if;
end loop;
while Count <= length(Cipher_Text)*2 loop
End_String := End_String & Get_Character(
S, Ind(Count*(length(Cipher_Text))/2), Ind(Count));
Count := Count + 2;
end loop;
return End_String;
end Decipher;