#include <iostream>
#include <cctype>
#include <string>
int main( int argc, char* argv[] )
{
const std::string VOWELS = "aeiou";
std::string phonetic = "consonant";
char input;
std::cout << "Please enter a letter: ";
// Don't worry if this line looks weird, it's just making
// sure the use enters a character.
while( !( std::cin >> input ) || input < 'A' || input > 'z' )
{
std::cout << "\nInvalid input. Try again: ";
std::cin.ignore( 256, '\n' );
std::cin.clear();
}
// We can use find to look for a series of characters in a string
// Note, we use tolower first as we've used lower case characters
// in our constant VOWELS string above
if( VOWELS.find( tolower( input ) ) != std::string::npos )
phonetic = "vowel";
std::cout << "Your letter is a " << phonetic << std::endl;
return 0;
}
thanx...ihutch105...i am really a beginner...an intermediate u cud say...
i hav no scope to learn programming in the area i liv in....so i am learning a bit with pdf books...