Computer Science Canada

inputting vowels, #s, etc in one string & output seperat

Author:  baby_bubblz [ 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

Author:  Tony [ Sun Nov 21, 2004 9:45 pm ]
Post 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.


: