Write a program that simulates the proverbial game of Russian Roulette. The program will prompt the user with how many players will be in the game where a maximum of 50 players can play. The program will next prompt the user to enter a "bad number" between 1 and 6. Once entered, the program will go in turn to each player that is in the game and assign a random number between 1 and 6 and compare it to the "bad number". If there is a match, then that player is out of the game. If there is no match, then that player remains in the game. Once all the players go through this process, the process repeats again in the next round for the remaining players starting again with the first player that is still in the game. Only players that are still in the game will receive a random number and have it compared to the "bad number". If a player is out of the game, then the player is ignored and does not receive a random number. This process continues to repeat this way round by round until only one player remains who will then be the winner. Suggestions: 1) You may want to declare an array representing the players with a bool data type where the value of true means a particular player is in the game and the value of false means they are out of the game. 2) Even though a for-loop is commonly used to maintain arrays, you may want to consider using a do-while loop for this program instead. 3) You may want to declare a variable for the number of players, the number of players still in the game, and a counter variable keeping track of when you have gone through all the players in a round so the index variable can then be reset to the first player for the next round.
Write a program that simulates the proverbial game of Russian Roulette. The program will prompt the user with how many players will be in the game where a maximum of 50 players can play. The program will next prompt the user to enter a "bad number" between 1 and 6. Once entered, the program will go in turn to each player that is in the game and assign a random number between 1 and 6 and compare it to the "bad number". If there is a match, then that player is out of the game. If there is no match, then that player remains in the game. Once all the players go through this process, the process repeats again in the next round for the remaining players starting again with the first player that is still in the game. Only players that are still in the game will receive a random number and have it compared to the "bad number". If a player is out of the game, then the player is ignored and does not receive a random number. This process continues to repeat this way round by round until only one player remains who will then be the winner. Suggestions: 1) You may want to declare an array representing the players with a bool data type where the value of true means a particular player is in the game and the value of false means they are out of the game. 2) Even though a for-loop is commonly used to maintain arrays, you may want to consider using a do-while loop for this program instead. 3) You may want to declare a variable for the number of players, the number of players still in the game, and a counter variable keeping track of when you have gone through all the players in a round so the index variable can then be reset to the first player for the next round.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Using C++
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY