program to find vowels and get rid of them
Author |
Message |
fkid
|
Posted: Tue Apr 13, 2004 4:44 pm Post subject: program to find vowels and get rid of them |
|
|
Ok... Basically I want to find a way to receive a word from a user, then find the vowels and afterwards, spell out the same word but without the vowels this time. This is what I have so far....
-------------------------------------------------------------------------------------
var word : string
var vowel : array 1 .. 10 of char
vowel (1) := 'a'
vowel (2) := 'e'
vowel (3) := 'i'
vowel (4) := 'o'
vowel (5) := 'u'
vowel (6) := 'A'
vowel (7) := 'E'
vowel (8 ) := 'I'
vowel (9) := 'O'
vowel (10) := 'U'
put "Please enter any one word for me to spell out without any vowels: " ..
get word
for i : 1 .. length (word)
for ii : 1 .. 10
if word (i) = vowel (ii) then
% put "" for the vowel how?
end if
end for
end for
put word % now how can i put the word without the vowels now??
-------------------------------------------------------------------------------------
Right now when I run the program, I get asked to input a word right. Then when I press Enter it just repeats the word. The problem is I want the program to repeat it but without the consonants so basically replace the vowels in the word with "". The comments show my main problems I guess..
Thanks for your time and help in advance!
Note: written in v.4.0.5 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
AsianSensation
|
|
|
|
![](images/spacer.gif) |
EDEN-E
|
Posted: Tue Apr 13, 2004 8:31 pm Post subject: Re: program to find vowels and get rid of them |
|
|
code: | var word : string
var vowel : array 1 .. 10 of char := init ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')
% you can give values to array variable using init(initialization)
var isvowel : boolean
% boolean type can have only true or false.
put "Please enter any one word for me to spell out without any vowels: " ..
get word
for i : 1 .. length (word)
isvowel := false
% set isvowel = false
for j : 1 .. 10
if word (i) = vowel (j) then
% if word(i) is a vowel
isvowel := true
% iswovel becomes true
end if
end for
if isvowel = false then
% if isvowel is false(isnot true), which means word(i) isnt vowel
put word (i) ..
end if
end for |
|
|
|
|
|
![](images/spacer.gif) |
nate
![](http://www.e-lacrosse.com/2004/nll/rock.gif)
|
Posted: Tue Apr 13, 2004 9:25 pm Post subject: (No subject) |
|
|
code: | var vowels : string := "aeiouAEIOU"
var word : string
put "Please enter any one word for me to spell out without any vowels:" ..
get word
for i : 1 .. length (word)
if index (vowels, word (i)) <= 0 then
put word (i)..
end if
end for |
God, just use the index function it makes life muh easier!!
Well, here u go some free code |
|
|
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
|
|
|
![](images/spacer.gif) |
fkid
|
Posted: Wed Apr 14, 2004 11:01 am Post subject: (No subject) |
|
|
Thanks soo much.... Never knew about the index command.. Now I know..
THANK YOU!! |
|
|
|
|
![](images/spacer.gif) |
|
|