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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eb2e0c5efa8c83d2,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-18 06:10:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!newsfeed.iinet.net.au!news.iinet.net.au!not-for-mail From: "Karl-Johan Karlsson" Sender: "Karl-Johan Karlsson" Reply-To: "Karl-Johan Karlsson" Subject: A very strange problem indeed... Newsgroups: comp.lang.ada X-User-Info: 203.59.189.46 Date: 18 Mar 2002 14:06:30 GMT Message-ID: <3c95f466$0$6552@motown.iinet.net.au> NNTP-Posting-Host: 203.59.24.218 X-Trace: news.iinet.net.au 1016460390 6552 203.59.24.218 Xref: archiver1.google.com comp.lang.ada:21405 Date: 2002-03-18T14:06:30+00:00 List-Id: Note that the following code details below are to do with the same program mentioned in the "if statement" thread involving a problem Steve Doiel helped me with (thanks a lot Steve!). The problem this time is that the string for the name entry is not working properly! If I have Name : String(1..20) it will only accept 20 characters and nothing less. If I delete four lines of the code (found below to do with size and amount) then the string accepts any amount of characters 20 or less in amount. Name : String(1..20); Name_Count : Natural; I have cut the program up into little tiny bits and I've discovered that the following four lines of code which preceed the Name code is why my Name string isn't working: Put("size you want: "); Item_Type_IO.Get(Choice); Put("amount you want: "); Get(Item_Amount); (These four lines do exactly what is required of them except that they seem to be effecting the Name code...) These four lines above are the ones which are making my name string accept only a certain amount of characters (e.g. 20), so if I type less characters it will not go to the next part of the program. Put("Please tell us"); New_Line; Put("your name: "); Get_Line(Name, Name_Count); The Name code above works only when I delete the size and amount code. So the four lines to do with the size and amount code are the problem, yet I cannot for the life of me understand why. Please, any assistance would be greatly appreciated! (Note that I need the name code to be just above the amount and item code!) Using Ada95 under Win98. Message previously posted: > > > Hello to group. > > I am currently writing a little program that determines how much a > customer's total cost will be for buying either Item1, Item2, Item3 > multiplied by the amount purchased (customer cannot purcase a combination > of items, just one at any amount). If the customer buys more than one > of Item3 the postage price is FREE. This is where I have confronted trouble > as when Item3 at two or more units purchased is inputted into the > program, the output displays two costs (cost with delivery, cost > without delivery) where I desire only the cost without delivery > to be displayed. I know this is because the code below needs to > be altered, but I am not sure how to go about doing it so I > require help. > > (There are if, elsif entries for Item1, Item2 prior to this code) > > ... > elsif Choice = Item3 then > Sum := Item_Amount * Item_Type + Postage_Charge; > Put("$"); > Put(Sum, 1, 2, 0); > > if Item_Amount > 1 then > Sum := Item_Amount * Item_Type > Put("$"); > Put(Sum, 1, 2, 0); > ... > > Also, I am using Ada98, not Ada83 under Win98.