inputting vowels, #s, etc in one string & output seperat
Author |
Message |
baby_bubblz
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|