answersLogoWhite

0


Best Answer

#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

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: A c plus plus program that defines vowels?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Can you program games with c plus plus?

Yes, you can program games with C++.


How to restart c plus plus program?

Exit the program and relaunch it.


Lint is a compiler b a interactive debugger c a cinterpreter d a tool for analysing c plus plus program?

d a tool for analysing c plus plus program


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Where did C plus plus program come from?

C++ is an extension of C, and was invented by Bjarne Stroustrup.


What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.


Can you rewrite a cuda file in c c plus plus language?

Yes, you can rewrite a cuda program originally written in c in c plus plus.


What is a C plus plus game project program?

A C++ game project program could either be a game written in C++ or a C++ library that helps you develop a game.


What are the Example Output of Calculator Program in C plus plus?

example output of c++ calculator


How does algorithm and c plus plus program get along?

They are bosom-friends.


Is there any benefit to a C plus plus program of round robin?

No.


C plus plus program to print number patterns?

bghjg