You test while(yesNo = 0), using the assignment (=) operator, and not an equality check (==). The assignment operator will return a reference to the number itself (0), which is equal to false in c++. Change this to the == operator. Also, you can probably just check while(yesNo), since a 0 is false and anything else is true (You tell the user to input yes=1 and no=0).