Re: Word counting
From: wave (mutilation_at_bonbon.net)
Date: 12/12/03
- Previous message: Lionel.DRAGHI_at_fr.thalesgroup.com: "RE: Ada Letters delivery"
- In reply to: ada_wizard_at_toadmail.com: "Re: Word counting"
- Next in thread: Jeffrey Carter: "Re: Word counting"
- Reply: Jeffrey Carter: "Re: Word counting"
- Reply: Steve: "Re: Word counting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Dec 2003 01:49:10 -0800
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.
- Previous message: Lionel.DRAGHI_at_fr.thalesgroup.com: "RE: Ada Letters delivery"
- In reply to: ada_wizard_at_toadmail.com: "Re: Word counting"
- Next in thread: Jeffrey Carter: "Re: Word counting"
- Reply: Jeffrey Carter: "Re: Word counting"
- Reply: Steve: "Re: Word counting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|