i'm having trouble in pulling out just the vowels from a string. not sure if i should use a for loop and just compare each letter or is there a better way?
Thanks in advance.
i'm having trouble in pulling out just the vowels from a string. not sure if i should use a for loop and just compare each letter or is there a better way?
Thanks in advance.
I believe that using a for loop would be the most efficient way of doing it, there might be some functions that will halp you do it but these usually have extra code that only take up extra CPU time...
just compare the elements to the vowels, and do this in a for loop.
Code:for (int i = 0; i < strlength; i++) { if (isalpha(ch)) { if (ch == 'A' || ch == 'a' || ch == 'E' etc........) //do whatever joo want } }
instead of
I would definately write a function called isvowel(), the code be much neater that wayCode:if (ch == 'A' || ch == 'a' || ch == 'E' etc........)
axon
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka