C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 21st, 2013, 11:51 PM
jackie777 jackie777 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 jackie777 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 58 sec
Reputation Power: 0
HELP on making a dictionary program in c language!!!

Hello guys.
I got a group assignment to make a dictionary program in c language, but my entire class just started learning c language at school so no one has solved this problem yet...
Could anyone please help me on making this program??

Okay so the goal is to make a dictionary program with these commands:
1.) :add, 2.) rint , 3.) :delete, 4.):save, 5.):load and 6.):quit.
An entry contains a word and its definition. It is assumed that one word has only one definition.


### Command definition ###

:add or :a [Word]
Add an entry of the following word. If the word is already in the dictionary, the program prompts the user whether or not the existing word would be overwritten or not. If the initial character of the word is lower case, replace it with its capital.

rint or ([Word])
If a word is not following, print all the entries in the dictionary. When a word is given after “rint” or “”, just print the word and its definition.

:delete or :d [Word]
Delete the entry of the given word.

:save or :s [Filename]
Save the current dictionary to a text file for later use.

:load or :l [Filename]
Load a dictionary from the text file. It overwrites the current dictionary.

:quit or :q
Quit the program immediately.
Your objective is to make the program, which behaves exactly the same as the sample below. The blue letters are user inputs.


What I wrote below is sample for this program.
ALL BLUE WORDS are things that we need to write on program
and ALL BLACK ONES are what the program should show.
*[ENTER] is hitting enter, not writing.

> ./linkedDict
dict~
### Adding "Apple" to the dictionary ###
:add Apple[ENTER]
Enter the definition: Fruit with red or yellow or green skin and sweet to tart crisp whitish
flesh.[ENTER]

### "Apple" is added ###


dict~
:print[ENTER]
Apple: Fruit with red or yellow or green skin and sweet to tart crisp whitish flesh.
Book: A written or printed work consisting of pages glued or sewn together along one side and bound in covers.
Dictionary: A reference book containing an alphabetical list of words, with information given for each word.

dict~
:p dictionary[ENTER]
Dictionary: A reference book containing an alphabetical list of words, with information given for each word.

dict~
:delete dictionary[ENTER]
### Deleting "Dictionary" ###
dictionary: A reference book containing an alphabetical list of words, with information
given for each word.
### "Dictionary" is deleted ###


dict~
:p
Apple: Fruit with red or yellow or green skin and sweet to tart crisp whitish flesh.
Book: A written or printed work consisting of pages glued or sewn together along one side
and bound in covers.

dict~
:save dict.txt
### The current dictionary was saved to "dict.txt" ###

dict~
:d dictionary[ENTER]
"Dictionary" is not found in the dictionary.

dict~
:a Apple[ENTER]
### "Apple" is already in the dictionary ###
### If you want to overwrite the definition, enter below, otherwise just hit ENTER. ###
Enter the definition: Apple Inc. is an American multinational corporation headquartered in Cupertino, California.[ENTER]
### "Apple" is modified ###

dict~
:a book[ENTER]
### "Book" is already in the dictionary ###
### If you want to overwrite the definition, enter below, otherwise just hit ENTER. ###
Enter the definition: [ENTER]
### "Book" is not modified ###

dict~
:s[ENTER]
Apple: Apple Inc. is an American multinational corporation headquartered in Cupertino,
California.
Book: A written or printed work consisting of pages glued or sewn together along one side
and bound in covers.

dict~
:load dict.txt
### A dictionary was loaded from "dict.txt" ###


dict~
:print
Apple: Fruit with red or yellow or green skin and sweet to tart crisp whitish flesh.
Book: A written or printed work consisting of pages glued or sewn together along one side
and bound in covers.

dict~
:quit
Quitting the dictionary program…
### Sample End ###

Since my group members are not familiar with c language, we haven't even begun writing anything
Please please please help me on making this program!!!!

Reply With Quote
  #2  
Old January 22nd, 2013, 02:39 AM
swapy swapy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 66 swapy Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 14 h 6 m 25 sec
Reputation Power: 0
okay,
So your requirements like

1.) :add, 2.) print , 3.) :delete, 4.):save, 5.):load and 6.):quit.

can be added in functions.

each function will do its task.
eg: add(char * word);
delete(char * word);

so you will need atleast 6 functions and call them accordingly in main.


You can store your dictionary in a text file.To retrieve data you need to use file handling.

thats a rough idea from where you can actually start the development.

Reply With Quote
  #3  
Old January 22nd, 2013, 02:59 AM
admiraln admiraln is offline
Still Learning
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Location: Montreal, Canada
Posts: 55 admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level)admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level)admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level)admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level)admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level)admiraln User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 18 h 57 m 51 sec
Reputation Power: 38
First thing you are going to have to do is read from a file or from the console a line a t a time. search for "read line in c" and look at the results. You should find several examples like this.

http://www.daniweb.com/software-development/c/code/216411/reading-a-file-line-by-line#

It may not given you the exact answer but it will give you code that you can run an experiment with.

Reply With Quote
  #4  
Old January 22nd, 2013, 04:02 AM
clifford's Avatar
clifford clifford is offline
Contributing User
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: UK
Posts: 4,825 clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 21 h 7 m 38 sec
Reputation Power: 1800
We need to be clear perhaps what the scope of this task is.

In Computer Science the term "dictionary" has specific meaning as an alternative name for an associative array; you could naturally implement your dictionary using an associative array, but I suspect that in this case that is not a requirement and perhaps too advanced and that the term "dictionary" is used in its general sense of a "lexicon". Is that the case?

It is unfortunate perhaps that you are not learning C++; the C++ standard library includes an associative array container that would make this task trivial.

The most appropriate solution will depend on what it is you have been taught, since the point of the assignment is to demonstrate learning. So the solution should be constructed from what you know or have at least covered in class. Since we don't know what that is, and solution offered here is likely to extend beyond that scope and you may be penalised that even if it is technically a better solution (the point being that it will not be your solution, and thus demonstrate nothing about what you have learned.

Not only do you need to show fair effort therefore, you need to give some guidance regarding acceptable techniques for solution.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > HELP on making a dictionary program in c language!!!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap