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-7-bit X-Google-Thread: 103376,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-19 20:06:02 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: ramunch@sigecom.net (Munch) Newsgroups: comp.lang.ada Subject: Re: Beginer problem: variable array size Date: 19 Sep 2002 20:06:02 -0700 Organization: http://groups.google.com/ Message-ID: <38993b18.0209191906.b56b982@posting.google.com> References: NNTP-Posting-Host: 63.64.8.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1032491162 24004 127.0.0.1 (20 Sep 2002 03:06:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 Sep 2002 03:06:02 GMT Xref: archiver1.google.com comp.lang.ada:29200 Date: 2002-09-20T03:06:02+00:00 List-Id: I think this is funny, almost every programming class that i've ever taken when you start a new language i swear I always do the same first two programs. 1. Hello World 2. The one that has the problem that apparently in ada takes a page of code where in C++ it takes about 4 lines. The problem is: Prompt the user to enter in an Integers followed by pressing , enter a 0 to terminate. At no point have a set ceiling on how many integers can be in the array. Sort using whatever sort algorithm makes you happy then display. I'm not elite programmer but I only see a few ways to easily (man thats relative) to accomplish this in Ada. 1. Implement a Linked List class and make it so that each node holds an Int. this seems like an over kill being as you successfully double the memory being consumed since every integer will have a head attached to it. 2. Implement a stack. Okay so I have to implement another abstract data type just to accomplish what inherently is a simple list problem. 3. Queue same as stack. Nacho pointed out that C++/C takes very few lines of code to accomplish this task. however ada will require me to write an entire sub-program or class just to accomplish this basic task. The one thing i haven't looked into is to see if there is a string tokenizer (is that what its called/) built in. basically read the numbers in and appened them to the end of an unbound string ( i know i saw that somewhere). Then parse it looking for spaces and converting the characters to their int form making the array then and copying them over. Again seems like I'm going From new york to new jersey but i've got a lay over in los angeles....*sigh*