after the the while loop is finished, i need to declare the player who took the last chip the winner, but i can't figure out how to do that.

Code:

#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
using namespace std;
int main()
{
int num_chips, chips_taken,max_available, initial_number_of_chips;
string player_1, player_2;
cout << "\nRules: The game starts with a pile of chips. Each player may only take at\n";
cout << "most half of the chips. The player that gets the last chip wins. Good luck."
<< "\nPlayer 1 please enter your first name:";
cin >> player_1;
cout << "\nPlayer 2 please enter your first name:";
cin >> player_2;
cout <<"\nThe current player is " << player_1;
cout <<"\n How many chips you would like to start with, " << player_1;
cin >> initial_number_of_chips;
chips_taken=0;
num_chips=initial_number_of_chips-chips_taken;
max_available=num_chips/2;
while (num_chips>1)
{
max_available=num_chips/2;
if(num_chips%2!=0)
{
(max_available)+=1;
}
cout<< "\n"<<player_1<<", it is your turn. There are "<<num_chips<<" available.\n";
cout<<"You may take up to "<<max_available<<". How many would you like to take?";
cin>>chips_taken;
while (chips_taken>(max_available) || chips_taken<1)
{
cout<<"\nError: Invalid number of chips. Please try again,";
cin>>chips_taken;
}
if (chips_taken <=num_chips/2 || chips_taken>=1)
{
num_chips=num_chips-chips_taken;
max_available=num_chips/2;
if(num_chips%2!=0)
{
max_available+=1;
}
cout<<"\n"<<player_2<<", it is your turn. There are "<<num_chips<<" remaining.\n";
cout<<"You may take up to ";
cout<<max_available<<". How many would you like to take?";
cin>>chips_taken;
}
while (chips_taken>(max_available) || chips_taken<1)
{
cout<<"\nError: Invalid number of chips. Please try again.";
cin>>chips_taken;
}
if (chips_taken<=(num_chips)/2|| chips_taken>=1)
{
num_chips=num_chips-chips_taken;
}
}
return 0;
}

any ideas? thanks for any help.