Dev - C++ - no se por que me salta de "queda 1 chance a -1

 
Vista:

no se por que me salta de "queda 1 chance a -1

Publicado por nicolas (1 intervención) el 26/06/2022 04:47:52
#include <stdio.h>
#include<stdlib.h>
#include<iostream>
#include<conio.h>
#include<string.h>

using namespace std;
void posiciones(int , int );
void posiciones2(int , int );
void posiciones3(int , int );
void posiciones4(int , int );
void posiciones5(int , int );
void posiciones6(int , int );

int main(){

int matriz[2] [3]={ {000},{077}};
int i,j;

int chances=3;
int acerto=0;


cout<<" | | |"<<endl;
cout<<" | | |"<<endl;
cout<<" v v v"<<endl;
cout<<" 0 1 2"<<endl;

cout<<" * * *"<<endl;
cout<<endl;
cout<<" * * *"<<endl;

juego:
cout<< " seleccione una posicion, empezemos por fila: ";
cin>>i;
system("cls");
cout<<" -------> 0 * * * " <<endl;
cout<<endl;
cout<<" -------> 1 * * * "<<endl;

cout<<" ahora seleccione una columna :";
cin>>j;

system("cls");


if ( i== 0 && j==0)
{


posiciones4( i , j );
chances--;
cout<<" TE QUEDAN "<<chances<<endl;
cout<<" CHANCES "<<endl;
if (chances==0)
{
cout<<" PERDIO PROFE , NOS TIENE QUE PONER UN 10"<<endl;
cout<<" GAME OVER" <<endl;
system("PAUSE");
return 0;
}
else
{
goto juego;
}
}
else if (i==0 && j==1)
{
posiciones5(i , j );
chances--;
cout<<" TE QUEDAN "<<chances<<endl;
cout<<" CHANCES "<<endl;
if (chances=0)
{
cout<<" PERDIO PROFE , NOS TIENE QUE PONER UN 10"<<endl;
cout<<" GAME OVER" <<endl;
system("PAUSE");
return 0;
}
else
{
goto juego;
}
}
else if (i==0 && j==2)
{
posiciones6( i , j );
chances--;
cout<<" TE QUEDAN "<<chances<<endl;
cout<<" CHANCES "<<endl;
if (chances=0)
{
cout<<" PERDIO PROFE , NOS TIENE QUE PONER UN 10"<<endl;
cout<<" GAME OVER" <<endl;
system("PAUSE");
return 0;
}
else
{
goto juego;
}
}
else if (i==1 && j==0)
{
posiciones3( i , j );
chances--;
cout<<" TE QUEDAN "<<chances<<endl;
cout<<" CHANCES "<<endl;
if (chances=0)
{
cout<<" PERDIO PROFE , NOS TIENE QUE PONER UN 10"<<endl;
cout<<" GAME OVER" <<endl;
system("PAUSE");
return 0;
}
else
{
goto juego;
}
}
























return 0;
}

void posiciones(int i , int j )
{
if (i==1 && j==2)
{
cout<<" * * *"<<endl;
cout<<endl;
cout<<" * * 7"<<endl;

cout<<"ACERTASTE!!!!!!"<<endl;


}
}


void posiciones2(int i , int j )
{
if (i==1 && j==1)
{
cout<<" * * *"<<endl;
cout<<endl;
cout<<" * 7 *"<<endl;

cout<<"ACERTASTE!!!!!!"<<endl;


}
}

void posiciones3(int i , int j )
{
if (i==1 && j==0)
{
cout<<" * * *"<<endl;
cout<<endl;
cout<<" 0 * *"<<endl;

cout<< "AGUA!!!!!!"<<endl;


}
}

void posiciones4(int i , int j )
{
if (i==0 && j==0)
{
cout<<" 0 * *"<<endl;
cout<<endl;
cout<<" * * *"<<endl;

cout<< "AGUA!!!!!!"<<endl;


}
}
void posiciones5(int i , int j )
{
if (i==0 && j==1)
{
cout<<" * 0 *"<<endl;
cout<<endl;
cout<<" * * *"<<endl;

cout<<" AGUA!!!!!!"<<endl;


}
}

void posiciones6(int i , int j )
{
if (i==0 && j==2)
{
cout<<" * * 0"<<endl;
cout<<endl;
cout<<" * * *"<<endl;

cout<<" AGUA!!!!!!"<<endl;


}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder