November 11th, 2013, 08:33 AM
Single nouns into plural string... Pls help...
When entering any noun, I have to change it into plural form.
This is the example what needs to be shown on screen is this:
enter a noun: wolf
Plural noun of wolf is wolves
These are the four rules:
1)for nouns ending with "y", have to delete "y" and put "ies"
2) for nouns ending with "f", have to delete "f" and put "ves"
3) for nouns ending with "s", "ch", "sh", have to put "es"
4) for nouns with none of the above put "s"
I have no idea how to start the coding...
November 11th, 2013, 09:37 AM
Your program will need a place to store the input.
What data type is appropriate?
"enter a noun" The program will interact with its master.
Is the entry one word at a time? Does the program need to read entire books and parse them for likely nouns? (Probably not.)
Can you write code to find the end of a word?
How about a main function to drive the project?
Make an outline, then fill in these details with code.
Consider leaving the outline in the program as your "program comments".
get word, maybe with a prompt.
/* check for finished */
if done, indicated by word length of 0 or end of file, perhaps
find the last character of the word
if rule 1 applies take that action and continue the forever loop.
if the second rule applies take that action and continue the forever loop.
if rule 3 applies---careful!
Make sure the word is long enough to back up 2 positions from the end.
write the word and also 's'
[/code] are essential for python code and Makefiles!