#include #include using namespace std; int main () { char answer; //setting up variable for Yes/No answer for playinh string name1; //Player 1's name string name2; //Player 2's name 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<<"Player 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(inputNum > chipCount/2) { cout << endl << name1 << " how many of the remaining " << chipCount << " chip(s) would you like (" << chipCount/2 << " max)?"; cin >> inputNum; while(inputNum > chipCount/2) { cout<<"Error: Chips taken must be at most half of the chips. (" << chipCount/2 << "max) "; cin >> inputNum; } inputNum <= chipCount/2 { chipCount=chipCount-inputNum; } } }