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

Username:   Password: 
 RegisterRegister   
 inputting vowels, #s, etc in one string & output seperat
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
baby_bubblz




PostPosted: Sun Nov 21, 2004 9:29 pm   Post subject: inputting vowels, #s, etc in one string & output seperat

hey, i'm kind of new to turing..would someone please help me with this question? thanks a lot!

Write a program, which inputs a string and the outputs each character in the string and whether or not it is a vowel, consonant, number, or any other character. For example, if "5te+" were input, then the output should be:

5 is a number

t is a consonant

e is a vowel

+ is any other character
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Nov 21, 2004 9:45 pm   Post subject: (No subject)

well break the string up into individual characters
code:

var text : string := "5te+"
for i : 1 .. length (text)
    put text (i)
end for

then just check if that character is a part of any character set

code:

put index("1234567890","5")
put index("1234567890","a")

5 is a digit because its a part of 1234567890 set. 'a' is not, so its not a digit.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: