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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,46ea53533b75e179 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-26 19:19:47 PST Date: Fri, 27 Feb 2004 11:19:20 +0800 From: Cecilia Chew User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: count_string program References: <403db7ee$1_1@news.tm.net.my> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 219.95.194.109 X-Original-NNTP-Posting-Host: 219.95.194.109 Message-ID: <403eb73b$1_1@news.tm.net.my> X-Trace: news.tm.net.my 1077851963 219.95.194.109 (27 Feb 2004 11:19:23 +0800) Organization: TMnet Malaysia Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!news.octanews.net!feed2.news.rcn.net!rcn!news-out.cwix.com!newsfeed.cwix.com!news1.tm.net.my Xref: archiver1.google.com comp.lang.ada:5877 Date: 2004-02-27T11:19:20+08:00 List-Id: Bj�rn Persson wrote: > Cecilia Chew wrote: > >> Hi all, >> I am doing a program that will count the input characters from user. >> There is a problem that I can't solve. >> Problem is : since I'm going to count the characters. So, I can't ask >> user how many characters they want to input. Compilation error come >> and mention that the string need to be constrainted. >> How am I going to constraint the string type since I don't know how >> many characters user going to input. > > > If you do want to store the characters, and not just count them, then > you obviously need a data type that can handle a variable number of > characters. The first place to look for a suitable data type is Ada's > standard library. > Since user will enter more than one characters, is that any problem if i placed the type string is array (positive range <>) of character; to handle a variable number of characters? As input is declared as type string, isn't the characters will be stored as the Get (input(i)); being executed?? -- Cecilia Chew c e c i l i a g r e e n l i m e . c o m