For clarity, i have commented in the code below where I am facing the problem.. Thanks in advance.
void Tennis :: play(Tennis & playertwo) { // Gets two players declared in the main function
bool serviceGame = 0;
do
{
cout <<"\n Set: "<< set <<endl;
cout <<"\n Game: "<<game <<endl;
cout <<"\n Player 1: "<< name <<endl;
cout <<"\n Player 2: "<< playertwo.name <<endl;
serviceGame = ( rand()%1+0 );
if ( serviceGame )
{
cout << endl << name << " wins the point " <<endl;
Tennis::winPoint( ); //player one wins the point
if ( point == 40 )
{
point = 'A';
}
else if ( point == 'A' )
{
Tennis::winSet( playertwo );
}
playertwo.winPoint(); //player 2 wins point
if ( playertwo.point == 40 )
{
playertwo.point = 'A';
}
else if ( playertwo.point == 'A' )
{
playertwo.winSet( ?? );
//!! ***** This is where I am facing problem. How do I pass the player one instance in this function??
}
}
} while ( game != 0 );

New Topic/Question
Reply




MultiQuote






|