Ada 编程/定界符/**
外观
(重定向自 Ada 编程/运算符/**)
"**" 运算符被定义为所有数值类型的算术幂。
function
"**" (Left : T; Right : Integer)return
T;
A :constant
Float := 5.0 ** 2; -- A is now 25.0 B :constant
Integer := 5 ** 2; -- B is also 25
with
Ada.Text_IO;procedure
Operator_Poweris
A :constant
Float := 5.0 ** 2; -- A is now 25.0 B :constant
Integer := 5 ** 2; -- B is also 25package
T_IOrenames
Ada.Text_IO;package
F_IOis
new
Ada.Text_IO.Float_IO (Float);package
I_IOis
new
Ada.Text_IO.Integer_IO (Integer);begin
T_IO.Put ("A = "); F_IO.Put ( Item => A, Fore => 3, Aft => 1, Exp => 0); T_IO.New_Line; T_IO.Put ("B = "); I_IO.Put ( Item => B, Width => 3, Base => 10); T_IO.New_Line;end
Operator_Power;
- 4.4 表达式 (带注释)
- 4.5.6 最高级运算符 (带注释)
- 4.4 表达式 (带注释)
- 4.5.6 最高级运算符 (带注释)
Ada 运算符 | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|