4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by firstPerson
1
lookin dat dar string
    izzit dat vowuel?
        yup, stop lookin'
        nope, keepa goin'

didja find it?
    yup, hola!
    nope, hola louda!
0
lookin dat dar string
    izzit dat vowuel?
        yup, stop lookin'
        nope, keepa goin'

didja find it?
    yup, hola!
    nope, hola louda!

LMAO, I love it. It's humorous and it gives the correct answer to the question.

To add some more insight into the answer I would put the vowels into a container like an array or vector. Then just loop through it one letter at a time. Tom's algorithm is correct, just translate it into C/C++.

for (int i = 0; i < mystring.length(); i++)
{
   for (int j = 0; j < myArrayLength; j++)
   {
         if (mystring[i] == myArray[j])
         {
             //it's a vowel
          }
    }
}
0

This should help :

string messageToYou(" try it out first");
string vowels("aeiouyw"); //whatever you think should be considered a vowel

size_t upTo = vowels.size();

for int i = 0 to UpTo, increment i
{
    if(message.find(vowels[i] != string::npos)
        //do something
  else //do something
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.