i need a c programme that reads a txt that you chosse then count the number of each word in the programme i have e.g.
"hello this word is very funny this is not"
hello 1
this 2
word 1
is 2
very 1
funny 1
not 1
i would love if anyone could help me with logic or real code ty guys

Recommended Answers

All 4 Replies

Well if I had to do this, I would investigate binary trees or get the book "The C Programming Language" which has an example of this code...

google is your friend. Here is a binary tree program written in C that was at the top of the google links. All you have to do with it is change the tree nodes to hold strings instead of integers and add an integer counter to count the number of times the word appears in the file, then read the file and insert the words. Your program will also have to first search the tree to see if the word already exists, and if it does then just increment its counter.

i have ask my teacher if i should use this way he said because i have not look at this part of see i would fail due i can shw learning out comes but thank guys i seen a jsp gram that had like if state and things liek that o just need help on the hold strings instead of integers and add an integer counter to count the number of times the word appears in the file part
the tree thing was fun to ook it

i have ask my teacher if i should use this way he said because i have not look at this part of see i would fail due i can shw learning out comes but thank guys i seen a jsp gram that had like if state and things liek that o just need help on the hold strings instead of integers and add an integer counter to count the number of times the word appears in the file part
the tree thing was fun to ook it

I cannot help commenting on this post. I sincerely hope you are not a native English speaker because this is just awful. Not a single punctuation mark?? Really, you've probably seen these cryptic symbols in the programs you've written, if you've ever written one that is.

I only lurked here for a short time before creating an account and I used to wonder why waltP and Narue were so cynical. Now I know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.