A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins.

For example:

  • number of passes = 1 and number of players   = 5, the order of elimination is 2, 4, 1, 5.   

Write a program for general values of X and N.

  • Ask a user for the number of people and number of passes
  • To speed up the input and debugging, you may wish to store the names of the people in a file. Make sure no two names start the same letter ( Alex and  Ana are not OK). Alternatively, you can number the players.
  • Output number and/or the name of a person being eliminated
  • Output number and the name of the winner
  • Do not expect a user to do the right thing, error check the user input; among other things, what do you think a reasonable minimum number of players would be?
  • Allow user to play the game as many times as the user wants
  • Node and List must be classes
    • classes must adhere to best practices and standards
    • if any part of an object is a pointer or dynamically allocated, follow the rule of three
  • use try/catch to check dynamic memory allocation C++ Dynamic Memory Allocation Supplement Download C++ Dynamic Memory Allocation Supplement
  • Make sure each function has a description, post, and pre-conditions
 
 
 
PreviousNext
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education