Program to accept Strings starting with a Vowel | C ++ program to accept String starting with Vowel ; Function to check if first character is vowel ; Function to check ; Driver function
#include <iostream> NEW_LINE using namespace std ; int checkIfStartsWithVowels ( string str ) { if ( ! ( str [ 0 ] == ' A ' str [ 0 ] == ' a ' str [ 0 ] == ' E ' str [ 0 ] == ' e ' str [ 0 ] == ' I ' str [ 0 ] == ' i ' str [ 0 ] == ' O ' str [ 0 ] == ' o ' str [ 0 ] == ' U ' str [ 0 ] == ' u ' ) ) return 1 ; else return 0 ; } void check ( string str ) { if ( checkIfStartsWithVowels ( str ) ) cout << " Not ▁ Accepted STRNEWLINE " ; else cout << " Accepted STRNEWLINE " ; } int main ( ) { string str = " animal " ; check ( str ) ; str = " zebra " ; check ( str ) ; return 0 ; }