How to make Boolean write True or False in Ada
8 October 2022 at 15:03
I'm very new to programming and have just gotten started with Records and boolean in Ada.
I'm trying to make it so that whenever I write 'T' it will say "True" and whenever I write 'F' it will say False, but IΒ΄m not sure how to do that. In this assignment I'm not allowed to change T: Boolean:= False;
this has to be in the code, but IΒ΄m not sure what I have to do to get what I want. I guess I have to do some sort of if statement like
But iΒ΄m not sure how to do that.
My code looks like the following:
type Sub_J is
record
Y: Character:= '9';
Q: Character:= 'p';
end record;
type Sub_B is
record
Y: Character:= 'J';
Q: Character:= 'o';
end record;
type Sub_O is
record
T: Boolean:= False;
L: Character:= '5';
end record;
type DS3 is
record
J: Sub_J;
B: Sub_B;
O: Sub_O;
end record;
procedure Get_3(DSThree: out DS3) is
Space: Character;
begin
Put("Mata in datamΓ€ngd: ");
Get(DSThree.J.Y);
Get(Space);
Get(DSThree.J.Q);
Get(Space);
Get(DSThree.B.Y);
Get(Space);
Get(DSThree.B.Q);
Get(Space);
Get(DSThree.O.T);
Get(Space);
Get(DSThree.O.L);
end Get_3;
procedure Put_3(DSThree: in DS3) is
begin
Put("Inmatad datamΓ€ngd: ");
Put(DSThree.J.Y);
Put(" ");
Put(DSThree.J.Q);
Put(" ");
Put(DSThree.B.Y);
Put(" ");
Put(DSThree.B.Q);
Put(" ");
Put(DSThree.O.T);
Put(" ");
Put(DSThree.O.L);
end Put_3;