From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT,T_FILL_THIS_FORM_SHORT,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,a2976536cf524fc2,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-28 12:03:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!mephistopheles.news.clara.net!news.clara.net!landlord!stones.POSTED!not-for-mail From: "J.Matthews" Newsgroups: comp.lang.ada Subject: User defined TYPE error X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Message-ID: Date: Wed, 25 Dec 2002 20:04:29 -0000 NNTP-Posting-Host: 212.159.54.196 X-Complaints-To: abuse@plus.net.uk X-Trace: stones 1041105779 212.159.54.196 (Sat, 28 Dec 2002 20:02:59 GMT) NNTP-Posting-Date: Sat, 28 Dec 2002 20:02:59 GMT Organization: Customer of PlusNet Xref: archiver1.google.com comp.lang.ada:32366 Date: 2002-12-25T20:04:29+00:00 List-Id: 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); 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;