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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,97643ec695b9bf73 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-12 01:49:11 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mutilation@bonbon.net (wave) Newsgroups: comp.lang.ada Subject: Re: Word counting Date: 12 Dec 2003 01:49:10 -0800 Organization: http://groups.google.com Message-ID: <4d01ad29.0312120149.ddda940@posting.google.com> References: NNTP-Posting-Host: 62.252.128.11 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1071222551 22526 127.0.0.1 (12 Dec 2003 09:49:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 12 Dec 2003 09:49:11 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:3412 Date: 2003-12-12T01:49:10-08:00 List-Id: Hello again, christ six replies already :) I appreciate the feedback so far, and realise that the program I gave was a pretty poor attempt at the problem at hand. After a while though, of messing about with it, I got tired and just decided to post the result I had so far. I'll try and respond to all your questions rather than quoting you all, bear with me though if I miss someone. All of your help is appreciated. Regarding the case if this is homework or not, I understand you people's stance on this. But you can rest, it is not, but an exercise in reading from files. I've been attempting similar programs such as extracting specific text from programs separated by comma values and other such spaces. It's not going very well, if you can tell :) I'm missing my fopen commands and tokenize functions from PHP! Anyway, I've taken most of your advice and I've rethought the pseudo code for the program. While not the end of the file Read the next line from the file Move the cursor one place and if character is within a..Z boundaries that character is stored in an array word_length(number) for that word length if the chracter is a space, then we've hit the end of that word length so increment our word length to search for by 1 (number). we've also hit the end of a word to increment our word count. End of loop; Loop through our array elements and hopefully we'll have the words with each corresponding length and their numbers. This coded correctly, with the input: This is an example input file it should hopefully work correctly but we'll see in a minute. should hopefully give us something like: (minus the formatting) ie words of length 1 / 2 / 3 / 4 / 5 / 6 : 1 / 4 / 2 / 3 / 1 / 2 I realise this is a complete mess and I'm thinking about scrapping the whole thing and starting again. For some reason I'm not managing to get my head around it and I'm unsure why. I appreciate your patience up to this far. Cheers again, Mut.