Program a simple text-based version of the Numberwang game. See the example execution below to see how it works.
Name your BitBucket repository exactly
csci221-HW01. Test with the script
Create one file, called
Do not add any other files to your repository. Only numberwang.cpp. You will lose points if you add the compiled program or other files.
Ask for two players’ names. These are string variables. Use
endl for newlines). Use these players’ names throughout the program, as shown below.
Ask for the number of rounds. Loop for this many rounds.
During each round, switch back-and-forth among each player to get their number guess. When their number is Numberwang, say so, and move on to the next round.
Each round alternates the player who goes first in that round. (And players alternate within the round.)
After the rounds are complete, report the players’ final scores. Indicate which player won by stating “P1 pulls ahead with…” as shown below. Of course, use the actual player’s name.
main() function, and one
numberwang(int) function (which returns a
bool type, i.e., true or false). You can create more functions if you feel so inspired.
Be sure to create a repository on BitBucket and add me (your instructor) as a viewer.
Hello, and welcome to Numberwang, the maths quiz that simply everyone is talking about! What is player 1's name? Tracy What is player 2's name? Josh How many rounds? 2 Well, if you're ready, let's play Numberwang! Round 1, Tracy to play first. Tracy: 14 Josh: 8 Tracy: 9 Josh: 37 Tracy: 99 That's Numberwang! Round 2, Josh to play first. Josh: 37 Tracy: 11.1 Josh: 87 That's Numberwang! Final scores: Tracy pulls ahead with 32, and Josh finishes with 13.