Question: Topic: Use the do while loop ( chapter 5 ) and switch statements ( chapter 4 ) and random numbers ( chapter 3 )

Topic: Use the "do while" loop (chapter 5) and switch statements (chapter 4) and random numbers (chapter 3).
Do not use "if","if else" and "if else if" statements.
DO NOT USE STRING VARIABLES
DO NOT USE FUNCTION (CHAPTER 6)
DO NOT USE ARRAY (CHAPTER 7)
Write a C++ program to play one or more random number games.
Put a program description and your name in code comments at the top.
The program asks users to enter three single characters separated by spaces (1 or more), and depending on the characters, it will generate a random number.
Here are the rules to follow exactly:
- If the input character is exactly 'a', the program will generate a random number from 1 to 20.
- If the input character is exactly 'e', the program will generate a random number from 21 to 40.
- If the input character is exactly 'i', the program will generate a random number from 41 to 60.
- If the input character is exactly 'o', the program will generate a random number from 61 to 80.
- If the input character is exactly 'u', the program will generate a random number from 81 to 100.
- If the input character is not one of the above characters, generate a 0 in the output.
Notes:
1- Inputs should only be lower-case letter vowels to be considered valid. Any other characters should show 0.
2- Program should not calculate any random numbers before checking the input characters.
3- Program should calculate only one random number for each input vowel.
4- Each input character should be used to create a separate output. For example, if the inputs are "a a a", the outputs would be three independent and different random numbers in the range of 1 and 20. Do not use the same random number for all 3 inputs.
5- It's expected that the program will have 3 character inputs and 3 separate "switch" statements that are very similar to each other for each game.
6- After each game, the program asks users to see if it should play another game. If users want to play another game, users answer with 'y' or 'Y'. The program should be able to handle any character answer other than 'y' or 'Y', including whitespaces.
Here are some sample runs:
This program plays a simple random number game.
Enter 3 lower vowel characters (a,e,i,o,u) separated by spaces: a e i
The random numbers are 52445
Do you want to play again? y
Enter 3 lower vowel characters (a,e,i,o,u) separated by spaces: A a u
The random numbers are 0888
Do you want to play again? y
Enter 3 lower vowel characters (a,e,i,o,u) separated by spaces: b o i
The random numbers are 06856
Do you want to play again? n
Topic: Use the " do while" loop ( chapter 5 ) and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!