"J.Matthews" wrote in message news:TrnP9.355$xE1.62211@stones... > Could someone possibly help. I get an error when I try to GET an amount. > I can make the program work without the user defined TYPE but I wanted > to restrict the input to valid monetary amounts i.e ���.pp format > > Any help appreciated > > > with ada.text_io,ada.integer_text_io,ada.float_text_io; > use ada.text_io,ada.integer_text_io,ada.float_text_io; > > procedure Money is > > Denomination : array (1..12) of integer := > (50,20,10,5,2,1,50,20,10,5,2,1); > type my_fixed is delta 0.01 range 0.00..1000.00; > Values : array (1..12) of my_fixed := > > (50.00,20.00,10.00,5.00,2.00,1.00,0.50,0.20,0.10,0.05,0.02,0.01); > Amount : my_fixed; > Count : array (1..12) of integer := (1..12 => 0); > Current_Value : integer := 0; > > begin > put("Enter Amount "); > get(Amount); Why are you using floating point I/O when you really need to instantiate Ada.Text_IO.Decimal_IO for your fixed point type? Your error is that you are trying to input a fixed point type using a floating point I/O package. > Amount := Amount+0.001; --ADA float number fix > Current_value := 1; > while Amount >= 0.01 loop > while Amount > values(Current_Value) loop > Amount := Amount - values(Current_Value); > Count(Current_Value) := Count(Current_Value)+1; > end loop; > Current_Value:=Current_Value+1; > End Loop; > new_line; > > for x in 1..4 loop > if Count(x) >= 1 then > put(Count(x)); > put(" X "); > put(character'val (156)); > put(denomination(x),width=>1); > if count(x) >=2 then > put_line(" NOTES"); > else > put_line(" NOTE"); > end if; > end if; > end loop; > > for x in 5..6 loop > if Count(x) >= 1 then > put(Count(x)); > put(" X "); > put(character'val (156)); > put(denomination(x),width=>1); > if count(x) >=2 then > put_line(" COINS"); > else > put_line(" COIN"); > end if; > end if; > end loop; > > for x in 7..12 loop > if Count(x) >= 1 then > put(Count(x)); > put(" X "); > put(denomination(x),width=>1); > if count(x) >=2 then > put_line("p COINS"); > else > put_line("p COIN"); > end if; > end if; > end loop; > > end money; Jim Rogers