string

hey anyone!!
I HAVE A PROBLEM AGAINST "STRING FUNCTIONS"
please..
i beg you to help regarding this problems about turbo C please help me..
its hard for me to answer...
these are:

1.using string functions.
Write a program that takes nouns and forms their plurals and the basis of these rules:
a. if noun ends in "y", remove the "y"and add "les"
b. if noun ends in "s", "ch", add "es"
c. in all other cases, just add "s"

2.using string functions.
write a program that takes data, a word at a time and reverses the words of the line.
sample input/output dialogue:

input string value: birds and bees
reversed: bees and birds

3.using string functions.
write a program that accepts the price of an item and display its coded value. the base of the key is:
X C O M P U T E R S
0 1 2 3 4 5 6 7 8 9

sample input/output dialogues:

Enter price:489.50
Coded value: PRS.UX

4.using string function
write a program that apply substitution method. here is given substitutino table:
A *
E $
I /
0 +
u -

sample input/output dialogue:
enter a message: meet me at 9:00am in the park
encrypted message: m$$t m$ *t 9:00*m /n th$ p*rk
For number 1, its fairly easy to look at individual string characters. Remember a string can be thought of as an array of characters, so you can "access" an index of a string. So you can check the size of the given string and then check the last index. if that index is a "y" then we will make a new string with "les" at the end. Follow the same idea by checking the last two indicies with "ch" and following suit.
Topic archived. No new replies allowed.