answersLogoWhite

0

#include<locale>

#include<iostream>

#include<string>

bool is_vowel(const char c)

{

static const std::string vowels = "AEIOU";

return( vowels.find(toupper(c))<vowels.size() );

}

int main()

{

std::string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

for(size_t i=0; i<alphabet.size(); ++i)

{

std::cout<<'\''<<alphabet[i]<<"\' is ";

if( !is_vowel( alphabet[i] ))

std::cout<<"not ";

std::cout<<"a vowel."<<std::endl;

}

}

Output:

'a' is a vowel.

'b' is not a vowel.

'c' is not a vowel.

'd' is not a vowel.

'e' is a vowel.

'f' is not a vowel.

'g' is not a vowel.

'h' is not a vowel.

'i' is a vowel.

'j' is not a vowel.

'k' is not a vowel.

'l' is not a vowel.

'm' is not a vowel.

'n' is not a vowel.

'o' is a vowel.

'p' is not a vowel.

'q' is not a vowel.

'r' is not a vowel.

's' is not a vowel.

't' is not a vowel.

'u' is a vowel.

'v' is not a vowel.

'w' is not a vowel.

'x' is not a vowel.

'y' is not a vowel.

'z' is not a vowel.

'A' is a vowel.

'B' is not a vowel.

'C' is not a vowel.

'D' is not a vowel.

'E' is a vowel.

'F' is not a vowel.

'G' is not a vowel.

'H' is not a vowel.

'I' is a vowel.

'J' is not a vowel.

'K' is not a vowel.

'L' is not a vowel.

'M' is not a vowel.

'N' is not a vowel.

'O' is a vowel.

'P' is not a vowel.

'Q' is not a vowel.

'R' is not a vowel.

'S' is not a vowel.

'T' is not a vowel.

'U' is a vowel.

'V' is not a vowel.

'W' is not a vowel.

'X' is not a vowel.

'Y' is not a vowel.

'Z' is not a vowel.

User Avatar

Wiki User

11y ago

What else can I help you with?