
-----------------------------------
thamilan
Wed Aug 13, 2008 7:21 pm

hello There
-----------------------------------
i want to make a program in c :
but am a bit stuck, so can you anyone jst guide me through it. 
Basically the program has to read in a whole paragraph, and the the program will have to find the words in the paragraph, then it has to sort the words into alphabetically order and and also  count the number of times the word appeared in the paragraph and then print, the words in alphabetically order with the frequency.
cheers , if anyone can just guide me through it it would be good. Ps i have developed the sorting algorithm for the program... its an insertion sort.

-----------------------------------
Dan
Wed Aug 13, 2008 7:45 pm

RE:hello There
-----------------------------------
Well we can help better if you give it a try first and post your code.

You will need to learn about the fallowing (as a minum) to do it:

file I/O or std (standard Arrays (or a hash table, map or dictionray type data structer of some kind) to store the words.
Functions, at least a function for the sorting algorithm
An implmentation of insertion sort in C (you should probly make this your self if this is an assigment).
Some kind of loop to go threw the words in the paragraph. Idealy a tokenizer of some kind in a foreach type loop. (Assuming you do not do the stroing and/or sorting of the words as they are being input).


-----------------------------------
michaelp
Wed Aug 13, 2008 8:33 pm

RE:hello There
-----------------------------------
http://compsci.ca/v3/viewtopic.php?t=12911

That tutorial from wtd should help get you started.

-----------------------------------
CodeMonkey2000
Wed Aug 13, 2008 8:39 pm

RE:hello There
-----------------------------------
Using C++ for this would be a lot easier. With C you might need to implement some sort of linked list structure, or something with dynamic memory allocation, since you don't know how many words there are.

-----------------------------------
Tony
Wed Aug 13, 2008 9:15 pm

RE:hello There
-----------------------------------
Using Python or Ruby or anything that supports working with text would be a lot easier.

-----------------------------------
md
Wed Aug 13, 2008 9:44 pm

RE:hello There
-----------------------------------
Awk would be great for this.

-----------------------------------
wtd
Wed Aug 13, 2008 9:59 pm

RE:hello There
-----------------------------------
Paying one of us several hundred dollars to do it for you would be tremendously easier.

-----------------------------------
md
Wed Aug 13, 2008 10:00 pm

RE:hello There
-----------------------------------
I'll do it for less then wtd. $100
