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 and switch statements chapter and random numbers chapter
Do not use ifif else" and if else if statements.
DO NOT USE STRING VARIABLES
DO NOT USE FUNCTION CHAPTER
DO NOT USE ARRAY CHAPTER
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 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 to
If the input character is exactly e the program will generate a random number from to
If the input character is exactly i the program will generate a random number from to
If the input character is exactly o the program will generate a random number from to
If the input character is exactly u the program will generate a random number from to
If the input character is not one of the above characters, generate a in the output.
Notes:
Inputs should only be lowercase letter vowels to be considered valid. Any other characters should show
Program should not calculate any random numbers before checking the input characters.
Program should calculate only one random number for each input vowel.
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 and Do not use the same random number for all inputs.
It's expected that the program will have character inputs and separate "switch" statements that are very similar to each other for each game.
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 lower vowel characters aeiou separated by spaces: a e i
The random numbers are
Do you want to play again? y
Enter lower vowel characters aeiou separated by spaces: A a u
The random numbers are
Do you want to play again? y
Enter lower vowel characters aeiou separated by spaces: b o i
The random numbers are
Do you want to play again? n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
