期望使用二进制运算符,但是除分隔符号

时间:2019-05-01 02:39:36

标签: ada

你好,我在函数的开始部分得到binary operator expected。我该如何解决?

procedure  float_test is
    A : Integer := 3;
    B : Integer := 2;
    F : Float;
begin
    F := (Float) A / (Float) B;
end float_test;

我从here: adacore.com那里获得了代码

procedure  float_test is
    A : Integer := 3;
    B : Integer := 2;
    F : Float;
begin
    F := A / B;
end float_test;

说明中说:The offending line must be changed to F := Float (A) / Float (B); in order to be accepted by the compiler.

1 个答案:

答案 0 :(得分:4)

在Ada中,您使用的语法稍有不同(看起来像是在使用C期望的语法)

代替:

F := Float(A) / Float(B);
相关问题