C++ Write a program that simulates a coin tossing game. At the beginning of the game, each of N…

C++

Write a program that simulates a coin tossing game. At the beginning of the game, each of N players has a single fair coin and M points. The game performs a sequence of passes until only a minimum number of players remain. In a pass the players toss their coins into the air and when the coins fall to earth, the players count the number of coins that show heads and the number of coins that show tails. If the number of heads exceed the number of tails, then the players who tossed heads increase their points by an integer P and the players who tossed tails decrease their points by the same integer P. The players perform the opposite actions when the number of tails is greater than the number of heads. If the number of heads equals the number of tails, then no player’s points change. If any player’s points fall below one, then the player leaves the game, never to return.

The game employs a second integer K to compute P’s value. K’s and P’s initial values are one. After each pass, the game adds K to P and then adds one to K. After the first pass P’s value is two and K’s value is two. After the second pass, P’s value is four and K’s value is three. After the third pass, P’s value is seven and K’s value is four. After the fourth pass, P’s value is eleven and K’s value is five. In general,

P(k) = 1 + k(k – 1) / 2

What is the minimum number of players? It is your responsibility to determine the minimum number of players.

Before the game begins the program should display the players’ names, their points, and P and K. After each pass, the program should display the number of heads tossed, the number of tails tossed, the number of players tossing coins, and P and K. In addition to this information, for each player tossing a coin, the program should display the player’s name, coin toss outcome – heads or tails, and the player’s points. If a player’s points are less than zero, the program should display zero. Do not display information about players who have left the game. After the game ends the program should display the names of the players with the maximum number of points, and P and K. To be clear, there is only one maximum number of points.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!