#include #include using namespace std; int main () { char answer; //setting up variable for Yes/No answer for playinh string name1 = ""; string name2 = ""; string player = ""; //Strings cout<<"Rules: The game starts with 1000 chips. Each player may only take at most half of the chips. The player that gets the last chip wins. Good luck!" <<"\nWould you like to play the chip game (y or n)? "; //Rules cin>>answer; //Answer if you want to play if (answer == 'n' || answer == 'N') //Both choices for not wanting to play { cout<< "Goodbye"; exit(0); //exits program if choice is no } else { if (answer == 'y' || answer == 'Y') //continues on with game if Yes { cout<<"\nPlayer 1 please enter your first name: "; //Player 1's name entered cin>> name1; cout<<"\nPlayer 2 please enter your first name: "; //Player 2's name entered cin>> name2; } } int chipCount = 1000; int inputNum; while(1) { if(player==name1) //supposed to switch players *doesn't work* { player==name2; } //else //{ //player==name1; //} cout << endl << player << " how many of the remaining " << chipCount << " chip(s) would you like (" << ((chipCount / 2) + (chipCount % 2)) << " max)?"; //displays message cin >> inputNum; while(inputNum > ((chipCount / 2) + (chipCount % 2))) //limits chips taken { cout<<"Error: Chips taken must be at most half of the chips. (" << ((chipCount / 2) + (chipCount % 2)) << "max) "; cin >> inputNum; } if(inputNum <= 0) //limits to only positive integers { cout<<"Error: Only positive integers are acceptable entries. (" << ((chipCount / 2) + (chipCount % 2)) << "max) "; } if(inputNum <= ((chipCount / 2) + (chipCount % 2))) //subtracts input from chip count { chipCount=chipCount-inputNum; } if(chipCount < 1) { cout<<"\nCongratulations "<