C++ Juegos
#include <cstdlib>
#include <time.h>
using namespace std;
char coma,cartas[3][3],asteriscos[3][3];
int ren1, col1, ren2, col2;
void juego()
{cartas[0][0]='A';
cartas[0][1]='B';
cartas[0][2]='C';
cartas[1][0]='D';
cartas[1][1]='A';
cartas[1][2]='B';
cartas[2][0]='C';
cartas[2][1]='D';
cartas[2][2]='E';
for (int r=0; r<3; r++)
{for (int c=0; c<3; c++)
{
cout<<cartas[r][c];
}
cout<<"\n";
}
cout<<" 1 2 3 \n";
cout<<" ";
for (int i=0; i<=8; i++)
{
cout<<" ";
}cout<<"\n";
for (int r=0; r<3; r++)
{
cout<<r+1<<" ";
for (int c=0; c<3; c++)
{
cout<<"* ";
}
cout<<"\n";
}
cout<<"\n";
cout<<"Ingresa tu primeracoordenada separada por una coma\n";
cin>>ren1>>coma>>col1;
cout<<"Ingresa la segunda coordenada separada por una coma\n";
cin>>ren2>>coma>>col2;ren1--;
col1--;
ren2--;
col2--;
cout<<" 1 2 3 \n";
cout<<" ";
for (int i=0; i<=8; i++)
{
cout<<" ";
}
cout<<"\n";
for (int r=0; r<3; r++)
{cout<<r+1<<" ";
for (int c=0; c<3; c++)
{
if ((r==ren1)&&(c==col1))
{
cout<<cartas[r][c]<<" ";
}
else
if((r==ren2)&&(c==col2))
{cout<<cartas[r][c]<<" ";
}
else
{
cout<<"* ";
}
}
cout<<"\n";
}
if (cartas[ren1][col1]==cartas[ren2][col2])
{
cout<<"Felicidades tienes un par\n";
}
else
{cout<<"No ese no es un par\n";
}
for (int b=0; b<=5; b++)
cout<<"\n";
}
void main()
{
juego();
system("pause");
}
k.. i think we are talking about thesame game..
see the basic idea will be to spread the pairs on a n X n board..
lets say we have a 4X4 board so we can have 8 type of cards on that board.
run a loop 8 times, in each iteration...
Regístrate para leer el documento completo.