with Ada.Text_IO;
use Ada.Text_IO;
procedure BoolVars is
package Bool_IO is new Ada.Text_IO.Enumeration_IO(Boolean);
use Bool_IO;
Correct :Boolean;
Maybe :Boolean;
Probably:Boolean;
begin
Correct:=True; -- TRUE
Maybe:=False; -- False
Probably:=Correct or Maybe; -- True
Probably:=Correct and Maybe; -- False
Probably:=Correct xor Maybe; -- True
Probably:=Correct and not Maybe; -- True
Probably:=Boolean'First; -- False
Probably:=Boolean'Last; -- True
if Maybe<Correct then
Put("FALSE is of less value than TRUE in a BOOLEAN variable");
New_Line;
end if;
Put(Correct,8);
Put(Maybe,8);
New_Line;
end BoolVars;
022.使用布尔变量
最新推荐文章于 2021-05-23 04:03:31 发布