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

Username:   Password: 
 RegisterRegister   
 program to find vowels and get rid of them
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fkid




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




PostPosted: Tue Apr 13, 2004 5:52 pm   Post subject: (No subject)

http://www.compsci.ca/v2/viewtopic.php?t=4040&highlight=vowel

search button.
EDEN-E




PostPosted: 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
nate




PostPosted: 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
Paul




PostPosted: Tue Apr 13, 2004 9:39 pm   Post subject: (No subject)

or you could just NOT post this, and have them find it using "search", this question or variations of this have been asked many times. Using search, you could have found these easily
http://www.compsci.ca/v2/viewtopic.php?t=4040&highlight=vowels
http://www.compsci.ca/v2/viewtopic.php?t=3631&highlight=vowels
http://www.compsci.ca/v2/viewtopic.php?t=2558&highlight=vowels
http://www.compsci.ca/v2/viewtopic.php?t=3753
http://www.compsci.ca/v2/viewtopic.php?t=440
they all help you find vowels or patterns in a string, once knowing how to do that, removing them is easy.
fkid




PostPosted: 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!!
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  [ 6 Posts ]
Jump to:   


Style:  
Search: