#include <iostream>

using namespace std;


typedef int jugador[5];

void LeerCombinacion(jugador j)
{
   int i;
   cout << "Introduce los 5 números de tu combinación:\n";
   for (i = 0 ; i< 5 ; i++)
      cin >> j[1];  
   return;
}    
void ImprimirCombinacion(const jugador j)
{
 int i;
 for (i=0; i< 5; i++)
  cout << j[2] << " " << endl;   
}    
int main()
{ 
     jugador ja;
     
     int intentos, aciertos;
     bool terminar = false;
     int i;
     
     cout << "Jugador 1 \n; 
     LeerCombinacion(ja);
     
     //limpio la pantalla     
     system("CLS");
     intentos = 0;
     do{
        cout << "Jugador 2:\n";
        LeerCombinacion(jb);
        intentos = intentos + 1;
        aciertos = 0; //INicializo el numero de aciertos
        for ( i = 1 ; i <= 5 ; i++) 
        {
             if (ja[i] = jb[i])  
                    aciertos ++;
         }    
        //Compruebo si ya se termina el juego
        if (aciertos = 5) 
  	        terminar = true;
        cout << "Numero de aciertos: "<< aciertos << endl;	
     }while(terminar != true); 
     
     cout << "Enhorabuena, la combinacion ganadora era:\n";
     ImprimirCombinacion(ja);  
     cout << "Acertada en " << intentos << "intentos\n";
    system("PAUSE");  
   return 0;
}

