Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Count Words

Reply
Thread Tools

Count Words

 
 
Vimal Aravindashan
Guest
Posts: n/a
 
      09-27-2005
Emmanuel Delahaye wrote:
> Vimal Aravindashan wrote on 26/09/05 :
>
>> It would be best if you used the hash_map container provided in the
>> STL package. Read the STL documentation for more help on hash_map.
>> Also, STL is C++, so if you do decide to take my advice into
>> consideration, please make it a point post any further questions to
>> c.l.c++

>
>
> How is any of this a response to a C-question ?
>


Read the OP's message again:

Foodbank wrote:
> Hello,
>
> I'm trying to develop a program that will enable me to count the number
> of words in a text file. As a plus, I'd like to be able to count how
> many different words there are too. I have a decent start on the
> program, but am quite unsure of where to move from here. I need to


In the problem statement the OP does not say that it has to be done in C
(Although, he has mentioned it his reply). The fact that he already has
a good start doesn't matter much if he is going to be stuck with
re-inventing the wheel. If it was up to me, then I would first get the
design right, and then figure out which language is best (unless there
is a constraint on the same, as in this case) to translate my design
into code. Moreover, the OP does say "any help" is welcome, so a
re-direction should really hurt much if it is going to save him quite
some time.

Cheers,
Vimal.


--
If you would be a real seeker after truth, it is necessary that at least
once in your life you doubt, as far as possible, all things."
-- Rene Descartes
 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      09-27-2005
"Foodbank" wrote:

> I've made some progress, but I'm getting incorrect word counts. Can
> anyone check out my code and see what I might be doing wrong?
>
> Thanks.
>
>
> #include <stdio.h>
> #include <stdlib.h>
> #define MAXWORDS 4000
> char *word[MAXWORDS];
> int wordcount[MAXWORDS];
> #define MAXWLEN 30
> char buff[MAXWLEN];
> int nwords, totalwords;


Shouldn't you give those an initial value?

<snip>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Words and non-words, according to Microsoft et al Steve B NZ Computing 11 03-21-2008 11:52 PM
Replace stop words (remove words from a string) BerlinBrown Python 6 01-17-2008 02:37 PM
Words Words utab C++ 6 02-16-2006 07:00 PM
Non-noise words are incorrectly recognised as noise words. Peter Strĝiman ASP .Net 1 08-23-2005 01:26 PM
Re: A little bit of help regarding my linked list program required. - "words.c" - "words.c" Richard Heathfield C Programming 7 10-05-2003 02:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57