Computer Science Canada

Arrays Help - How do you post a specific letter from a word

Author:  PerylDemise [ Wed Apr 26, 2006 10:24 pm ]
Post subject:  Arrays Help - How do you post a specific letter from a word

Need a little help please. ^_^; I have to make a program that has the user input words and when they are finished the screen is cleared and 3 columns are shown.

The first column has the user's original words, the second column has all the vowels in each word entered and the last column has all the consonants of each word entered.

So far I am able to get the user's input an store it into an array and display all the words but I don't know how to check through the words and find out which ones are vowels and which are consonants.

The outcome of the columns would look something like this (aside from the " - "):

Quote:

Original word------------Vowels--------------Consonants
+++++++++++++++++++++++++++++++++++
was-----------------------a---------------------ws
him -----------------------i---------------------hm
together------------------oee------------------tgthr
cradle---------------------ae-------------------crdl
monitor-------------------oio-------------------mntr
toe------------------------oe--------------------t

Author:  Tony [ Wed Apr 26, 2006 10:44 pm ]
Post subject: 

you could use
word(n) to get the nth letter of the word

and index() to see if a pattern (in this case a letter) is within a string (in this case a collection of consonants or vowels

Author:  do_pete [ Thu Apr 27, 2006 11:50 am ]
Post subject: 

To make the columns you will need to use put like this:
code:
put a : 10, b : 10, c : 10

where 10 is the number of spaces you have to print your text. For example:
code:
put "a" : 10, "b" : 10, "c" : 10

will give you
code:
a---------b---------c---------
as output[/quote]

Author:  Thuged_Out_G [ Sat Apr 29, 2006 12:36 am ]
Post subject: 

http://www.compsci.ca/v2/viewtopic.php?t=12015

That may help, if you havent already figured out how to get the vowels/consonants


: