Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 hello There
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
thamilan




PostPosted: Wed Aug 13, 2008 7:21 pm   Post subject: 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.
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Aug 13, 2008 7:45 pm   Post subject: 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 [keybord]) I/O if it is not from a file.
  • 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).
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
michaelp




PostPosted: Wed Aug 13, 2008 8:33 pm   Post subject: RE:hello There

http://compsci.ca/v3/viewtopic.php?t=12911

That tutorial from wtd should help get you started.
CodeMonkey2000




PostPosted: Wed Aug 13, 2008 8:39 pm   Post subject: 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




PostPosted: Wed Aug 13, 2008 9:15 pm   Post subject: RE:hello There

Using Python or Ruby or anything that supports working with text would be a lot easier.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
md




PostPosted: Wed Aug 13, 2008 9:44 pm   Post subject: RE:hello There

Awk would be great for this.
wtd




PostPosted: Wed Aug 13, 2008 9:59 pm   Post subject: RE:hello There

Paying one of us several hundred dollars to do it for you would be tremendously easier.
md




PostPosted: Wed Aug 13, 2008 10:00 pm   Post subject: RE:hello There

I'll do it for less then wtd. $100
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: