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

Username:   Password: 
 RegisterRegister   
 Arrays Help - How do you post a specific letter from a word
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
PerylDemise




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Apr 26, 2006 10:44 pm   Post subject: (No 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
do_pete




PostPosted: Thu Apr 27, 2006 11:50 am   Post subject: (No 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]
Thuged_Out_G




PostPosted: Sat Apr 29, 2006 12:36 am   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: