So I need this to print when vowel you entered instead of just telling you that you wrote a vowel.

I'm straight up not sure how your suppose to do that! I went ahead and wrote the code for inputting vowels not sure whats next.

#include <iostream>

using namespace std;

int main ()
{
char letter;

cout << "Enter a single lowercase letter and press Enter: ";
cin >> letter;

switch (letter)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
cout << "You entered a vowel!";
break;
}
cout << endl;



system("PAUSE");
return EXIT_SUCCESS;
return 0;	
}

Umm, cout << letter; maybe?

lol yeah I got it thanks though I was staring at for a while!!!

Another question!!! How do I get this program to print ei when you input e. Apparently I have to figure out how to mess up my program.

>> Another question!!! How do I get this program to print ei when you input e. Apparently I have to figure out how to mess up my program.

Before getting too involved, you perhaps should explain what you're doing and why. I can think of a whole bunch of ways to mess up your program, but messing it up the "right" way requires a little more knowledge.

This is the question I am trying to address.

A student is asked to write a switch whose behavior is as follows:
the switch is controlled by a variable of type char. There are three cases: if the char is a vowel ('a',
'e', 'i', 'o', 'u'), the entered vowel wil be printed, otherwise, the message "Not a vowel" will be output.about:blank

When the assignment is turned in, the instructor notices that upon entering the letter 'e', the letter 'i' is
also printed. This does not happen when entering any other vowel, that is , if any of 'a', 'i', 'o', 'u', are
entered, only the input vowel will be printed.

COMPLETE THE CODE IN THE SWITCH ABOVE SO THAT THE PROGRAM CONTAINS
EXACTLY THE SAME ERROR AS THE STUDENT'S. In other words, make sure that ONLY
when you entered an 'e' from the keyboard the letter 'i' is also printed. IN any other case, ONLY the
vowel entered is printed , or the error message "Not a vowel", if c does not contain a vowel.

Well then you probably DO NOT want to use cout << letter; then. You'll likely have 5 cases, each of which has a different cout statement, then a default statement, which has a sixth cout statement. Write it so it's right, THEN look at it and see how to break it.

You'll need to display "Not a vowel" when it isn't a vowel.

It's a simple error to do. But without your code set up properly, you can't replicate it. And since we can't see your code, it's hard to help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.