Question: Use C++ On a roulette wheel, the pockets are numbered 0 thru 36. The colors of the pockets are as follows: Pocket 0 is green
Use C++
On a roulette wheel, the pockets are numbered 0 thru 36. The colors of the pockets are as follows:
Pocket 0 is green
For Pockets 1 thru 10, the odd-numbered pockets are red and the even numbered pockets are black.
For Pockets 11 thru 18, the odd-numbered pockets are black and the even numbered pockets are red.
For Pockets 19 thru 28, the odd-numbered pockets are red and the even numbered pockets are black.
For Pockets 29 thru 36, the odd-numbered pockets are black and the even numbered pockets are red.
Create a C++ project which that asks the user to enter a pocket number and displays whether the pocket is green, red or black. The program should display an error message if the user enters a number that is outside the range of 0 through 36. Name your file roulette.cpp.
Hint: Keep in mind that a number can be identified as even/odd by examining the remainder of int division by2.
Hint: Use the % operator to determine if a number is even or odd. If a number is divided by 2 it either has a remainder of 0 or 1. If the remainder is 0, the number is even. If the remainder is 1 if the number is odd.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
