|
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Genders is (Male, Female, Unknown);
begin
Put_Line("Gender = " & Genders'image(Genders'First));
end Exercise;
This would produce:
Gender = MALE
|
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Genders is (Male, Female, Unknown);
begin
Put_Line("Gender = " & Genders'image(Genders'Last));
end Exercise;
This would produce:
Gender = UNKNOWN
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Names is (John, Raymondo, Gertrude, Anselme, Patricia, Lucius);
begin
Put_Line("Name = " & Names'image(Names'Min(Raymondo, Anselme)));
end Exercise;
This would produce:
Name = RAYMONDO
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Names is (John, Raymondo, Gertrude, Anselme, Patricia, Lucius);
begin
Put_Line("Name = " & Names'image(Names'Max(Raymondo, Anselme)));
end Exercise;
This would produce:
Name = ANSELME
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Names is (John, Raymondo, Gertrude, Anselme, Patricia, Lucius);
begin
Put_Line("Name = " & Names'image(Names'Succ(Names'Min(Raymondo, Anselme))));
end Exercise;
This would produce:
Name = GERTRUDE
with Ada.Text_IO;
use Ada.Text_IO;
procedure Exercise is
type Names is (John, Raymondo, Gertrude, Anselme, Patricia, Lucius);
begin
Put_Line("Name = " & Names'image(Names'Pred(Names'Min(Raymondo, Anselme))));
end Exercise;
This would produce:
Name = JOHN