"ADA.FLOAT_IO" 不是预定义的库单元
"ADA.FLOAT_IO" is not a predefined library unit
为什么会出现此错误?
"ADA.FLOAT_IO" is not a predefined library unit
我以前从来没有用 ADA 写过任何东西,只是我不知道我在做什么。我用GNAT编译。
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_IO; use Ada.Float_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure MAIN is
A,B,C:Float;
W : Float;
Re, Im:Float;
begin
Put("Give A");Get(A);
Put("Give B");Get(B);
Put("Give C");Get(C);New_Line;
if A=0.0 then
Put_Line("It is not second degree polynomial");
else
W:=B*B - 4.0*A*C;
Re:=B/(2.0*A); Im:=Sqrt(Abs(W))/(2.0*A);
Put("dif = "); Put(W);New_Line;
if W<0.0 then
Put_Line("Complex ");
Put("x1 = ");Put(-Re);Put(" -j ");Put(Im);Put(" ");
Put("x2 = ");Put(-Re);Put(" +j ");Put(Im);New_Line;
else
Put_Line("Real");
Put("x1 = ");Put(-Re-Im);Put(" ");
Put("x2 = ");Put(-Re+Im);
end if;
end if;
end MAIN;
IIRC Float_IO
是 Text_IO
的 child:Ada.Text_IO.Float_IO
。此外,这是一个通用包。我猜你想要 Ada.Float_Text_IO
,定义为
package Ada.Float_Text_IO is new Ada.Text_IO.Float_IO (Float);
为什么会出现此错误?
"ADA.FLOAT_IO" is not a predefined library unit
我以前从来没有用 ADA 写过任何东西,只是我不知道我在做什么。我用GNAT编译。
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_IO; use Ada.Float_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure MAIN is
A,B,C:Float;
W : Float;
Re, Im:Float;
begin
Put("Give A");Get(A);
Put("Give B");Get(B);
Put("Give C");Get(C);New_Line;
if A=0.0 then
Put_Line("It is not second degree polynomial");
else
W:=B*B - 4.0*A*C;
Re:=B/(2.0*A); Im:=Sqrt(Abs(W))/(2.0*A);
Put("dif = "); Put(W);New_Line;
if W<0.0 then
Put_Line("Complex ");
Put("x1 = ");Put(-Re);Put(" -j ");Put(Im);Put(" ");
Put("x2 = ");Put(-Re);Put(" +j ");Put(Im);New_Line;
else
Put_Line("Real");
Put("x1 = ");Put(-Re-Im);Put(" ");
Put("x2 = ");Put(-Re+Im);
end if;
end if;
end MAIN;
IIRC Float_IO
是 Text_IO
的 child:Ada.Text_IO.Float_IO
。此外,这是一个通用包。我猜你想要 Ada.Float_Text_IO
,定义为
package Ada.Float_Text_IO is new Ada.Text_IO.Float_IO (Float);