# HW01: Numberwang

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 /home/jeckroth/csci221/homework/HW01/grader.pl [bitbucketusername]

## Requirements

Create one file, called numberwang.cpp.

Ask for two players’ names. These are string variables. Use cout and cin (and 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.

Create one 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.

## Example execution

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.


CSCI 221 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.