I saw this in your other thread, but I didn't touch it because you're using non-standard functions... that may be the source of your problem... see below:
Code:
#include<iostream>
#include<string>
//#include<algoritm> //my guess is to include transform?
using namespace std;
int isVowel(string mystring);
int main()
{
string vowelcheck;
cout << "Enter a sentence: " << endl;
getline(cin, vowelcheck, '\n');
cout << "There are " << isVowel(vowelcheck) << " vowels in this sentence." << endl;
return 0;
}
int isVowel(string mystring)
{
int numvow = 0;
//transform (mystring.begin(), mystring.end(), mystring.begin(), tolower); //non-standard function (AFAIK)
int l=mystring.length(); //returns the length of the string
char ch; //to hold the individual characters of the string
for(int i=0;i<l;i++) //loop through each character in the string
{
ch=mystring.at(i); //get the character from the string
ch=toupper(ch); //change it to upper-case (upper-case letters have lower
//ascii values than do lower-case letters, not that it
//matters at all.
if( ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' ) //check to see if it's a vowel
{
numvow++; //if it is, increase the count
}
}
return numvow; //return the number of vowels in the string
}