
#include <iostream.h>
//Base Class 
class Player {

public:
    virtual int getGuess(){
    return 0;
  }
}

//Human Class to accept the value from human by using getGuess() method
class HumanPlayer : public Player {

public:
int getGuess(){
	cout<<"Guess the number"
	int guess;
	cin>>guess;
	return guess;
	}
}


// Class to choose the value by Computer by using getGuess() method
class ComputerPlayer : public Player {

public:
int getGuess(){
	int guess2=rand()%100;
            return guess2;
	}
}


class GamePlay {

bool checkForWin( int guess, int answer ) 
{ 
	cout<< “You guessed ” << guess << “.”; 
	if ( answer == guess ) 
   	{ 
		cout<< “You’re right! You win!” <<endl; 
		return true; 
   	} 
	else if (answer < guess ) 
	cout<< “Your guess is too high.” <<endl; 
	else
	cout<< “Your guess is too low.”  <<endl; 
	return false; 
} 



void play( Player &player1, Player &player2 ) 
{ 
	int answer = 0, guess = 0; 
	answer = rand( ) % 100;   // requires <cstdlib>
	bool win = false; 

	while( !win ) 
   	      { 
	           cout<< “Player 1’s turn to guess.” <<endl; 
		guess = player1.getGuess(); 
		win = checkForWin( guess, answer ); 
		if ( win ) return; 
		cout<< “Player 2’s turn to guess.” <<endl; 
		guess = player2.getGuess(); 
		win = checkForWin( guess, answer ); 
   	       } 
}  

char ch;

 int main() {

        
    cout<<"choose 1 :playing game between Human and Computer"
    cout<<"choose 2 :playing game between computer and Computer"
    cout<<"choose 3 :playing game between Human and Computer"    
   
    switch(ch) {
     case '1' :
                         HumanPlayer player1;
                         ComputerPlayer player2;
                         GamePlay gp;        
                         gp.play(player1,player2);
                         break;
   
     case '2' :
                         ComputerPlayer player1;
                         ComputerPlayer player2;
                         GamePlay gp;        
                         gp.play(player1,player2);
                         break;
         
                  

     case '3' :
                         HumanPlayer player1;
                         HumanPlayer player2;
                         GamePlay gp;        
                         gp.play(player1,player2);
                         break;
     default:  cout<<"u are not specified the correct option"
      
}

 }