Answer to Question #283874 in C++ for Collay

Question #283874

2. A, e, i, o, u?

by CodeChum Admin

We've had enough about numbers, so why don’t we try evaluating characters now?


If you know how to identify what the vowel letters are, and you know how to count up to 5, then you’re good to go!



Instructions:

  1. Using a do…while() loop, continuously scan for characters (one per line) and print it out afterwards.
  2. The loop shall terminate due to either of the following reasons:
  3. The inputted character is a vowel
  4. The number of inputted characters has already reached 5.

Input

Multiple lines containing a character on each. It is guaranteed that all the characters are in lower case format.


c
f
a
b
c

Output

Multiple lines containing a character on each.


c
f
a
1
Expert's answer
2022-01-02T02:24:09-0500
using namespace std;






int main()
{
	char c;
	int n=0,Flag=1;
	
	do
	{
		cout<<"\n\tEnter a character: "; cin>>c;
		n=n+1;
		if(c=='a' ||c=='e' ||c=='i' || c=='o' ||c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U' || n>4) Flag=0;
	}while(Flag==1);
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog