I am just a beginner in C++ and I am trying to scan the first character of an inputted string for vowels using simple syntaxes
I tried using array of strings for vowels
string vowels[] = {"a","e","i","o","u"};
string word;
string first;
cout<< "enter a word: ";
cin>>word;
cout<<endl;
first = word.substr(0,1);
cout<<first<<endl;
if (first == vowels)
{
cout << "NO!"<<endl;
}
else
{
cout<< word <<endl;
}
return 0;
if condition yields an error:
Invalid operands to binary expression ('string' (aka 'basic_string, allocator >') and 'string *' (aka 'basic_string, allocator > *'))