Page 53 of "Programming in Ada 2012" by John Barnes shares an incomplete fragment of code that I cannot get to work.
I've come up with this as a full program expanding the code from the book...
with Ada.Numerics; use Ada.Numerics;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Coin is (Heads, Tails);
package Random_Coin is new Discrete_Random(Coin);
use Random_Coin;
G : Generator;
C : Coin;
begin
for i in 1 .. 20 loop
C := Random(G);
Put (C'Image);
end loop;
end Main;
The "GPS" IDE I'm using complains of the following errors:
- Line 6: "Discrete_Random" is undefined
- Line 7: "Random_Coin" is undefined
- Line 9: "Generator" is undefined
- Line 14: "Random" is undefined
The IDE does give me the "intellisense" (to use a term from Visual Studio) that indicates that Discrete_Random is actually visible and available given the "with" and "use" statements I've added.
Can someone walk me through the stupid mistakes I'm making please?
with Ada.Numerics.Discrete_Random;- egilhh