#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <sstream>
using namespace std;
string eq1;
string eq2;
string eq3;
string eq4;
void resultados(int bolean1,int bolean2,int bolean3, int bolean4, int emGanPer1[7],int emGanPer2[7],int emGanPer3[7],int emGanPer4[7]){
if(bolean1 == 0){
bolean1 = 4;
}else if(bolean2 == 0){
bolean2 = 4;
}else if(bolean3 == 0){
bolean3 = 4;
}else{
bolean4 = 4;
}
if(bolean1 == 1){
cout<<eq1<<": "<<emGanPer1[0]<<" "<<emGanPer1[2]<<" "<<emGanPer1[3]<<" "<<emGanPer1[4]<<" "<<emGanPer1[5]<<" "<<emGanPer1[6]<<" "<<emGanPer1[7]<<endl;
}else if(bolean2 == 1){
cout<<eq2<<": "<<emGanPer2[0]<<" "<<emGanPer2[2]<<" "<<emGanPer2[3]<<" "<<emGanPer2[4]<<" "<<emGanPer2[5]<<" "<<emGanPer2[6]<<" "<<emGanPer2[7]<<endl;
}else if(bolean3 == 1){
cout<<eq3<<": "<<emGanPer3[0]<<" "<<emGanPer3[2]<<" "<<emGanPer3[3]<<" "<<emGanPer3[4]<<" "<<emGanPer3[5]<<" "<<emGanPer3[6]<<" "<<emGanPer3[7]<<endl;
}else{
cout<<eq4<<": "<<emGanPer4[0]<<" "<<emGanPer4[2]<<" "<<emGanPer4[3]<<" "<<emGanPer4[4]<<" "<<emGanPer4[5]<<" "<<emGanPer4[6]<<" "<<emGanPer4[7]<<endl;
}
if(bolean1 == 2){
cout<<eq1<<": "<<emGanPer1[0]<<" "<<emGanPer1[2]<<" "<<emGanPer1[3]<<" "<<emGanPer1[4]<<" "<<emGanPer1[5]<<" "<<emGanPer1[6]<<" "<<emGanPer1[7]<<endl;
}else if(bolean2 == 2){
cout<<eq2<<": "<<emGanPer2[0]<<" "<<emGanPer2[2]<<" "<<emGanPer2[3]<<" "<<emGanPer2[4]<<" "<<emGanPer2[5]<<" "<<emGanPer2[6]<<" "<<emGanPer2[7]<<endl;
}else if(bolean3 == 2){
cout<<eq3<<": "<<emGanPer3[0]<<" "<<emGanPer3[2]<<" "<<emGanPer3[3]<<" "<<emGanPer3[4]<<" "<<emGanPer3[5]<<" "<<emGanPer3[6]<<" "<<emGanPer3[7]<<endl;
}else{
cout<<eq4<<": "<<emGanPer4[0]<<" "<<emGanPer4[2]<<" "<<emGanPer4[3]<<" "<<emGanPer4[4]<<" "<<emGanPer4[5]<<" "<<emGanPer4[6]<<" "<<emGanPer4[7]<<endl;
}
if(bolean1 == 3){
cout<<eq1<<": "<<emGanPer1[0]<<" "<<emGanPer1[2]<<" "<<emGanPer1[3]<<" "<<emGanPer1[4]<<" "<<emGanPer1[5]<<" "<<emGanPer1[6]<<" "<<emGanPer1[7]<<endl;
}else if(bolean2 == 3){
cout<<eq2<<": "<<emGanPer2[0]<<" "<<emGanPer2[2]<<" "<<emGanPer2[3]<<" "<<emGanPer2[4]<<" "<<emGanPer2[5]<<" "<<emGanPer2[6]<<" "<<emGanPer2[7]<<endl;
}else if(bolean3 == 3){
cout<<eq3<<": "<<emGanPer3[0]<<" "<<emGanPer3[2]<<" "<<emGanPer3[3]<<" "<<emGanPer3[4]<<" "<<emGanPer3[5]<<" "<<emGanPer3[6]<<" "<<emGanPer3[7]<<endl;
}else{
cout<<eq4<<": "<<emGanPer4[0]<<" "<<emGanPer4[2]<<" "<<emGanPer4[3]<<" "<<emGanPer4[4]<<" "<<emGanPer4[5]<<" "<<emGanPer4[6]<<" "<<emGanPer4[7]<<endl;
}
if(bolean1 == 4){
cout<<eq1<<": "<<emGanPer1[0]<<" "<<emGanPer1[2]<<" "<<emGanPer1[3]<<" "<<emGanPer1[4]<<" "<<emGanPer1[5]<<" "<<emGanPer1[6]<<" "<<emGanPer1[7]<<endl;
}else if(bolean2 == 4){
cout<<eq2<<": "<<emGanPer2[0]<<" "<<emGanPer2[2]<<" "<<emGanPer2[3]<<" "<<emGanPer2[4]<<" "<<emGanPer2[5]<<" "<<emGanPer2[6]<<" "<<emGanPer2[7]<<endl;
}else if(bolean3 == 4){
cout<<eq3<<": "<<emGanPer3[0]<<" "<<emGanPer3[2]<<" "<<emGanPer3[3]<<" "<<emGanPer3[4]<<" "<<emGanPer3[5]<<" "<<emGanPer3[6]<<" "<<emGanPer3[7]<<endl;
}else{
cout<<eq4<<": "<<emGanPer4[0]<<" "<<emGanPer4[2]<<" "<<emGanPer4[3]<<" "<<emGanPer4[4]<<" "<<emGanPer4[5]<<" "<<emGanPer4[6]<<" "<<emGanPer4[7]<<endl;
}
}
int main(){
cout<<"Dime los nombres de los 4 equipos que participaron en esta face y te dare la puntuacion";
cout<<"\n Dame el nombre de el primer equipo :"<<endl;
cin>>eq1;
equipo2:
cout<<"\n Dame el nombre de el segundo equipo :"<<endl;
cin>>eq2;
if (eq1==eq2){
cout<<"este equipo ya existe"<<endl;
goto equipo2;
}
equipo3:
cout<<"\n Dame el nombre de el tercer equipo :"<<endl;
cin>>eq3;
if (eq1==eq3){
cout<<"este equipo ya existe"<<endl;
goto equipo3;
}
else if (eq2==eq3){
cout<<"este equipo ya existe"<<endl;
goto equipo3;
}
equipo4:
cout<<"\n Dame el nombre de el cuarto equipo :"<<endl;
cin>>eq4;
if (eq1==eq4){
cout<<"este equipo ya existe"<<endl;
goto equipo4;
}
else if (eq2==eq4){
cout<<"este equipo ya existe"<<endl;
goto equipo4;
}else if (eq3==eq4){
cout<<"este equipo ya existe"<<endl;
goto equipo4;
}
system("CLS");
cout<<"los equipos que participan en esta face son: "<<eq1<<" ,"<<eq2<<" ,"<<eq3<<" ,"<<eq4<<endl;
string eq1p;
string eq3p;
string eq2p;
string eq4p;
std::vector<std::string> vctGol1;
std::vector<std::string> vctGolC1;
std::vector<std::string> vctGol3;
std::vector<std::string> vctGolC3;
std::vector<std::string> vctPts1;
std::vector<std::string> vctPts3;
std::vector<std::string> vctGol4;
std::vector<std::string> vctGolC4;
std::vector<std::string> vctGol2;
std::vector<std::string> vctGolC2;
std::vector<std::string> vctPts4;
std::vector<std::string> vctPts2;
std::vector<std::string> vctGan1;
std::vector<std::string> vctGan2;
std::vector<std::string> vctGan3;
std::vector<std::string> vctGan4;
cout<<"primera ronda "<<eq1<<" vs "<<eq3<<endl;
cout<<"goles del equipo "<<eq1<<": ";
cin>>eq1p;
cout<<"goles del equipo "<<eq3<<": ";
cin>>eq3p;
vctGol1.push_back(eq1p);
vctGolC1.push_back(eq3p);
vctGol3.push_back(eq3p);
vctGolC3.push_back(eq1p);
if(eq1p>eq3p){
vctPts1.push_back("3");
vctPts3.push_back("0");
vctGan1.push_back(""+eq1);
vctGan3.push_back(""+eq1);
}
else if(eq1p<eq3p){
vctPts1.push_back("0");
vctPts3.push_back("3");
vctGan1.push_back(""+eq3);
vctGan3.push_back(""+eq3);
}else{
vctPts1.push_back("1");
vctPts3.push_back("1");
vctGan1.push_back("");
vctGan3.push_back("");
}
cout<<"Segunda ronda "<<eq1<<" vs "<<eq2<<endl;
cout<<"goles del equipo "<<eq1<<": ";
cin>>eq1p;
cout<<"goles del equipo "<<eq2<<": ";
cin>>eq2p;
vctGol1.push_back(eq1p);
vctGolC1.push_back(eq2p);
vctGol2.push_back(eq2p);
vctGolC2.push_back(eq1p);
if(eq1p>eq2p){
vctPts1.push_back("3");
vctPts2.push_back("0");
vctGan1.push_back(""+eq1);
vctGan2.push_back(""+eq1);
}
else if(eq1p<eq2p){
vctPts1.push_back("0");
vctPts2.push_back("3");
vctGan1.push_back(""+eq2);
vctGan2.push_back(""+eq2);
}else{
vctPts1.push_back("1");
vctPts2.push_back("1");
vctGan1.push_back("");
vctGan2.push_back("");
}
cout<<"tercera ronda "<<eq1<<" vs "<<eq4<<endl;
cout<<"goles del equipo "<<eq1<<": ";
cin>>eq1p;
cout<<"goles del equipo "<<eq4<<": ";
cin>>eq4p;
vctGol1.push_back(eq1p);
vctGolC1.push_back(eq4p);
vctGol4.push_back(eq4p);
vctGolC4.push_back(eq1p);
if(eq1p>eq4p){
vctPts1.push_back("3");
vctPts4.push_back("0");
vctGan1.push_back(""+eq1);
vctGan4.push_back(""+eq1);
}
else if(eq1p<eq4p){
vctPts1.push_back("0");
vctPts4.push_back("3");
vctGan1.push_back(""+eq4);
vctGan4.push_back(""+eq4);
}else{
vctPts1.push_back("1");
vctPts4.push_back("1");
vctGan1.push_back("");
vctGan4.push_back("");
}
cout<<"cuarta ronda "<<eq2<<" vs "<<eq3<<endl;
cout<<"goles del equipo "<<eq2<<": ";
cin>>eq2p;
cout<<"goles del equipo "<<eq3<<": ";
cin>>eq3p;
vctGol2.push_back(eq2p);
vctGolC2.push_back(eq3p);
vctGol3.push_back(eq3p);
vctGolC3.push_back(eq2p);
if(eq2p>eq3p){
vctPts2.push_back("3");
vctPts3.push_back("0");
vctGan2.push_back(""+eq2);
vctGan3.push_back(""+eq2);
}
else if(eq2p<eq3p){
vctPts2.push_back("0");
vctPts3.push_back("3");
vctGan2.push_back(""+eq3);
vctGan3.push_back(""+eq3);
}else{
vctPts2.push_back("1");
vctPts3.push_back("1");
vctGan2.push_back("");
vctGan3.push_back("");
}
cout<<"quinta ronda "<<eq2<<" vs "<<eq4<<endl;
cout<<"goles del equipo "<<eq2<<": ";
cin>>eq2p;
cout<<"goles del equipo "<<eq4<<": ";
cin>>eq4p;
vctGol2.push_back(eq2p);
vctGolC2.push_back(eq4p);
vctGol4.push_back(eq4p);
vctGolC4.push_back(eq2p);
if(eq2p>eq4p){
vctPts2.push_back("3");
vctPts4.push_back("0");
vctGan2.push_back(""+eq2);
vctGan4.push_back(""+eq2);
}
else if(eq2p<eq4p){
vctPts2.push_back("0");
vctPts4.push_back("3");
vctGan2.push_back(""+eq4);
vctGan4.push_back(""+eq4);
}else{
vctPts2.push_back("1");
vctPts4.push_back("1");
vctGan2.push_back("");
vctGan4.push_back("");
}
cout<<"sexta ronda "<<eq3<<" vs "<<eq4<<endl;
cout<<"goles del equipo "<<eq3<<": ";
cin>>eq3p;
cout<<"goles del equipo "<<eq4<<": ";
cin>>eq4p;
vctGol3.push_back(eq3p);
vctGolC3.push_back(eq4p);
vctGol4.push_back(eq4p);
vctGolC4.push_back(eq3p);
if(eq3p>eq4p){
vctPts3.push_back("3");
vctPts4.push_back("0");
vctGan3.push_back(""+eq3);
vctGan4.push_back(""+eq3);
}
else if(eq3p<eq4p){
vctPts3.push_back("0");
vctPts4.push_back("3");
vctGan3.push_back(""+eq4);
vctGan4.push_back(""+eq4);
}else{
vctPts3.push_back("1");
vctPts4.push_back("1");
vctGan3.push_back("");
vctGan4.push_back("");
}
system("CLS");
//equipo1 vctPts1
int gano=0;
int empato=0;
int perdio=0;
int gf=0;
int gc=0;
int pts=0;
//estadisticas primer equipo
for (int i = 0; i < vctPts1.size(); i++){
if (vctPts1[i]=="3"){
gano++;
pts= pts + 3;
}else if (vctPts1[i]=="1"){
empato++;
pts= pts + 1;
}else{
perdio++;
}
int x = 0;
stringstream geek(vctGol1[i]);
geek >> x;
gf = gf + x;
int y = 0;
stringstream geek1(vctGolC1[i]);
geek1 >> y;
gc = gc + y;
}
int emGanPer1[7] = {gano,empato,perdio,gf,gc,gf-gc,pts};
//estadisticas segundo equipo
gano=0; empato=0; perdio=0; gf=0; gc=0; pts=0;
for (int i = 0; i < vctPts2.size(); i++){
if (vctPts2[i]=="3"){
gano++;
pts= pts + 3;
}else if (vctPts2[i]=="1"){
empato++;
pts= pts + 1;
}else{
perdio++;
}
int x = 0;
stringstream geek(vctGol2[i]);
geek >> x;
gf = gf + x;
int y = 0;
stringstream geek1(vctGolC2[i]);
geek1 >> y;
gc = gc + y;
}
int emGanPer2[7] = {gano,empato,perdio,gf,gc,gf-gc,pts};
//estadisticas tercer equipo
gano=0; empato=0; perdio=0; gf=0; gc=0; pts=0;
for (int i = 0; i < vctPts3.size(); i++){
if (vctPts3[i]=="3"){
gano++;
pts= pts + 3;
}else if (vctPts3[i]=="1"){
empato++;
pts= pts + 1;
}else{
perdio++;
}
int x = 0;
stringstream geek(vctGol3[i]);
geek >> x;
gf = gf + x;
int y = 0;
stringstream geek1(vctGolC3[i]);
geek1 >> y;
gc = gc + y;
}
int emGanPer3[7] = {gano,empato,perdio,gf,gc,gf-gc,pts};
//estadisticas cuarto equipo
gano=0; empato=0; perdio=0; gf=0; gc=0; pts=0;
for (int i = 0; i < vctPts4.size(); i++){
if (vctPts4[i]=="3"){
gano++;
pts= pts + 3;
}else if (vctPts4[i]=="1"){
empato++;
pts= pts + 1;
}else{
perdio++;
}
int x = 0;
stringstream geek(vctGol4[i]);
geek >> x;
gf = gf + x;
int y = 0;
stringstream geek1(vctGolC4[i]);
geek1 >> y;
gc = gc + y;
}
int emGanPer4[7] = {gano,empato,perdio,gf,gc,gf-gc,pts};
int tot1 = emGanPer1[6];
int tot2 = emGanPer2[6];
int tot3 = emGanPer3[6];
int tot4 = emGanPer4[6];
int dif1 = emGanPer1[5];
int dif2 = emGanPer2[5];
int dif3 = emGanPer3[5];
int dif4 = emGanPer4[5];
int golTf1 = emGanPer1[3];
int golTf2 = emGanPer2[3];
int golTf3 = emGanPer3[3];
int golTf4 = emGanPer4[3];
int bolean1= 0;
int bolean2= 0;
int bolean3= 0;
int bolean4= 0;
//Primer lugar
if(tot1>tot2 and tot1>tot3 and tot1>tot4){
bolean1 = 1;
}else if(tot2>tot1 and tot2>tot3 and tot2>tot4 ){
bolean2 = 1;
}else if(tot3>tot1 and tot3>tot2 and tot3>tot4 ){
bolean3 = 1;
}else if(tot4>tot1 and tot4>tot2 and tot4>tot3 ){
bolean4 = 1;
}else if(tot1==tot2 and tot1>tot3 and tot1>tot4 and tot2>tot3 and tot2>tot4){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq2){
bolean3 = 1;
break;
}else if(vctGan1[i] != "" && vctGan3[i] ==eq1){
bolean1 = 1;
break;
}
}
}else if(tot1==tot3 and tot1>tot2 and tot3>tot2 and tot1>tot4 and tot3>tot4){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq3){
bolean3 = 1;
break;
}else if(vctGan1[i] != "" && vctGan3[i] ==eq1){
bolean1 = 1;
break;
}
}
}else if(tot1==tot4 and tot1>tot2 and tot1>tot3 and tot4>tot2 and tot4>tot3){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq4){
bolean4 = 1;
break;
}else if(vctGan1[i] != "" && vctGan4[i] ==eq1){
bolean1 = 1;
break;
}
}
}else if(tot2==tot3 and tot2>tot1 and tot2>tot4 and tot3>tot1 and tot3>tot4){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq3){
bolean3 = 1;
break;
}else if(vctGan2[i] != "" && vctGan3[i] ==eq2){
bolean2 = 1;
break;
}
}
}else if(tot2==tot4 and tot2>tot1 and tot2>tot3 and tot4>tot1 and tot4>tot3){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq4){
bolean4 = 1;
break;
}else if(vctGan2[i] != "" && vctGan4[i] ==eq2){
bolean2 = 1;
break;
}
}
}else if(tot3==tot4 and tot3>tot1 and tot3>tot2 and tot4>tot1 and tot4>tot2){
for (int i = 0; i < vctGan3.size(); i++){
bolean3 = 0;
if(vctGan2[i] == eq4){
bolean4 = 1;
break;
}else if(vctGan2[i] != "" && vctGan4[i] ==eq3){
bolean3 = 1;
break;
}
}
}
if(tot1==tot2 and tot2==tot3 and tot4<tot3 and bolean1==0 and bolean2==0 and bolean3==0 and bolean4==0){
if(dif1<dif2 and dif1<dif3){
bolean1 = 1;
}else if(dif2<dif1 and dif2<dif3){
bolean2 = 1;
}else if(dif3<dif1 and dif3<dif2 ){
bolean3 = 1;
}
}else if(tot2==tot3 and tot3==tot4 and tot1<tot3 and bolean1==0 and bolean2==0 and bolean3==0 and bolean4==0){
if(dif2<dif3 and dif2<dif4){
bolean2 = 1;
}else if(dif3<dif2 and dif3<dif4){
bolean3 = 1;
}else if(dif4<dif2 and dif4<dif3 ){
bolean4 = 1;
}
}else if(tot1==tot3 and tot3==tot4 and tot2<tot3 and bolean1==0 and bolean2==0 and bolean3==0 and bolean4==0){
if(dif1<dif3 and dif1<dif4){
bolean1 = 1;
}else if(dif3<dif1 and dif3<dif4 ){
bolean3 = 1;
}else if(dif4<dif1 and dif4<dif3 ){
bolean4 = 1;
}
}else if(tot1==tot2 and tot2==tot4 and tot3<tot4 and bolean1==0 and bolean2==0 and bolean3==0 and bolean4==0){
if(dif1<dif2 and dif1<dif4){
bolean1 = 1;
}else if(dif2<dif1 and dif2<dif4){
bolean2 = 1;
}else if(dif4<dif1 and dif4<dif2){
bolean4 = 1;
}
}
if(bolean1==0 and bolean2==0 and bolean3==0 and bolean4==0){
if(golTf1>golTf2 and golTf1>golTf3 and golTf1>golTf4){
bolean1 = 1;
}else if(golTf2>golTf1 and golTf2>golTf3 and golTf2>golTf4){
bolean2 = 1;
}else if(golTf3>golTf1 and golTf3>golTf2 and golTf3>golTf4){
bolean3 = 1;
}else if(golTf4>golTf1 and golTf4>golTf2 and golTf4>golTf3){
bolean4 = 1;
}else{
bolean1 = 1;
}
}
//Segundo si el primer lugar gano equipo1
if(bolean1 == 1){
if(tot2>tot3 and tot2>tot4 ){
bolean2 = 2;
}else if(tot3>tot2 and tot3>tot4 ){
bolean3 = 2;
}else if(tot4>tot2 and tot4>tot3 ){
bolean4 = 2;
}else if(tot2==tot3 and tot2>tot4 and tot3>tot4){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq3){
bolean3 = 2;
break;
}else if(vctGan2[i] != "" && vctGan3[i] ==eq2){
bolean2 = 2;
break;
}
}
}else if(tot2==tot4 and tot2>tot3 and tot4>tot3){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan2[i] != "" && vctGan4[i] ==eq2){
bolean2 = 2;
break;
}
}
}else if(tot3==tot4 and tot3>tot2 and tot4>tot2){
for (int i = 0; i < vctGan3.size(); i++){
bolean3 = 0;
if(vctGan3[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan3[i] != "" && vctGan4[i] ==eq3){
bolean3 = 2;
break;
}
}
}
if(tot2==tot3 and tot3==tot4 and bolean2==0 and bolean3==0 and bolean4==0){
if(dif2>dif3 and dif2>dif4){
bolean2 = 2;
}else if(dif3>dif2 and dif3>dif4){
bolean3 = 2;
}else if(dif4>dif2 and dif4>dif3){
bolean4 = 2;
}
}
if(bolean2==0 and bolean3==0 and bolean4==0){
if( golTf2>golTf3 and golTf2>golTf4){
bolean2 = 2;
}else if( golTf3>golTf2 and golTf3>golTf4){
bolean3 = 2;
}else if(golTf4>golTf2 and golTf4>golTf3){
bolean4 = 2;
}else{
bolean2 = 2;
}
}
}
//Segundo si el primer lugar gano equipo2
if (bolean2 == 1){
if(tot1>tot3 and tot1>tot4){
bolean1 = 2;
}else if(tot3>tot1 and tot3>tot4 ){
bolean3 = 2;
}else if(tot4>tot1 and tot4>tot3 ){
bolean4 = 2;
}else if(tot1==tot3 and tot1>tot4 and tot3>tot4){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq3){
bolean3 = 2;
break;
}else if(vctGan1[i] != "" && vctGan3[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot1==tot4 and tot1>tot3 and tot4>tot3){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan1[i] != "" && vctGan4[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot3==tot4 and tot3>tot1 and tot4>tot1){
for (int i = 0; i < vctGan3.size(); i++){
bolean3 = 0;
if(vctGan3[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan3[i] != "" && vctGan4[i] ==eq3){
bolean3 = 2;
break;
}
}
}
if(tot1==tot3 and tot3==tot4 and bolean1==0 and bolean3==0 and bolean4==0){
if(dif1>dif3 and dif1>dif4){
bolean1 = 2;
}else if(dif3>dif1 and dif3>dif4 ){
bolean3 = 2;
}else if(dif4>dif1 and dif4>dif3 ){
bolean4 = 2;
}
}
if(bolean1==0 and bolean3==0 and bolean4==0){
if(golTf1>golTf3 and golTf1>golTf4){
bolean1 = 2;
}else if(golTf3>golTf1 and golTf3>golTf4){
bolean3 = 2;
}else if(golTf4>golTf1 and golTf4>golTf3){
bolean4 = 2;
}else{
bolean1 = 2;
}
}
}
//Segundo si el primer lugar gano equipo3
if(bolean3 == 1){
if(tot1>tot2 and tot1>tot4){
bolean1 = 2;
}else if(tot2>tot1 and tot2>tot4 ){
bolean2 = 2;
}else if(tot4>tot1 and tot4>tot2 ){
bolean4 = 2;
}else if(tot1==tot2 and tot1>tot4 and tot2>tot4){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq2){
bolean2 = 2;
break;
}else if(vctGan1[i] != "" && vctGan2[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot1==tot4 and tot1>tot2 and tot4>tot2 ){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan1[i] != "" && vctGan4[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot2==tot4 and tot2>tot1 and tot4>tot1 ){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq4){
bolean4 = 2;
break;
}else if(vctGan2[i] != "" && vctGan4[i] ==eq2){
bolean2 = 2;
break;
}
}
}
if(tot1==tot2 and tot2==tot4 and bolean1==0 and bolean2==0 and bolean4==0){
if(dif1>dif2 and dif1>dif4){
bolean1 = 2;
}else if(dif2>dif1 and dif2>dif4){
bolean2 = 2;
}else if(dif4>dif1 and dif4>dif2){
bolean4 = 2;
}
}
if(bolean1==0 and bolean2==0 and bolean4==0){
if(golTf1>golTf2 and golTf1>golTf4){
bolean1 = 2;
}else if(golTf2>golTf1 and golTf2>golTf4){
bolean2 = 2;
}else if(golTf4>golTf1 and golTf4>golTf2){
bolean4 = 2;
}else{
bolean1 = 2;
}
}
}
//Segundo si el primer lugar gano equipo4
if(bolean4 == 1){
if(tot1>tot2 and tot1>tot3){
bolean1 = 2;
}else if(tot2>tot1 and tot2>tot3 ){
bolean2 = 2;
}else if(tot3>tot1 and tot3>tot2 ){
bolean3 = 2;
}else if(tot1==tot2 and tot1>tot3 and tot2>tot3){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq2){
bolean2 = 2;
break;
}else if(vctGan1[i] != "" && vctGan2[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot1==tot3 and tot1>tot2 and tot3>tot2 ){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq3){
bolean3 = 2;
break;
}else if(vctGan1[i] != "" && vctGan3[i] ==eq1){
bolean1 = 2;
break;
}
}
}else if(tot2==tot3 and tot2>tot1 and tot3>tot1 ){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq3){
bolean3 = 2;
break;
}else if(vctGan2[i] != "" && vctGan3[i] ==eq2){
bolean2 = 2;
break;
}
}
}
if(tot1==tot2 and tot2==tot3 and bolean1==0 and bolean2==0 and bolean3==0){
if(dif1>dif2 and dif1>dif3){
bolean1 = 2;
}else if(dif2>dif1 and dif2>dif3){
bolean2 = 2;
}else if(dif3>dif2 and dif3>dif1){
bolean3 = 2;
}
}
if(bolean1==0 and bolean2==0 and bolean3==0){
if(golTf1>golTf2 and golTf1>golTf3){
bolean1 = 2;
}else if(golTf2>golTf1 and golTf2>golTf3){
bolean2 = 2;
}else if(golTf3>golTf1 and golTf3>golTf2){
bolean3 = 2;
}else{
bolean1 = 2;
}
}
}
//Tercer lugar si el eq1 y eq2 ya tienen posicion
if(bolean1 != 0 and bolean2 !=0){
if(tot3>tot4 ){
bolean3 = 3;
}else if(tot3<tot4 ) {
bolean4 = 3;
}else if(tot3==tot4){
for (int i = 0; i < vctGan3.size(); i++){
bolean3 = 0;
if(vctGan3[i] == eq4){
bolean4 = 3;
break;
}else if(vctGan3[i] != "" && vctGan4[i] ==eq3){
bolean3 = 3;
break;
}
}
}
if(tot3==tot4 and bolean4==0 and bolean3==0){
if(dif3>dif4){
bolean3 = 3;
}else if(dif3<dif4){
bolean4 = 3;
}
}
if( bolean4==0 and bolean3==0){
if(golTf3>golTf4){
bolean3 = 3;
}else if(golTf4>golTf3){
bolean4 = 3;
}else{
bolean3 = 3;
}
}
}
//Tercer lugar si el eq1 y eq3 ya tienen posicion
if(bolean1 != 0 and bolean3 !=0 and bolean2 ==0 and bolean4==0){
if(tot2>tot4 ){
bolean2 = 3;
}else if(tot2<tot4 ) {
bolean4 = 3;
}else if(tot2==tot4){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq4){
bolean4 = 3;
break;
}else if(vctGan2[i] != "" && vctGan4[i] ==eq2){
bolean2 = 3;
break;
}
}
}
if(tot2==tot4 and bolean4==0 and bolean2==0){
if(dif2>dif4 ){
bolean2 = 3;
}else if (dif2<dif4 ){
bolean4 = 3;
}
}
if(bolean4==0 and bolean2==0){
if(golTf2>golTf4){
bolean2 = 3;
}else if(golTf4>golTf3){
bolean4 = 3;
}else{
bolean2 = 3;
}
}
}
//Tercer lugar si el eq1 y eq4 ya tienen posicion
if(bolean1 != 0 and bolean4 !=0 and bolean2 ==0 and bolean3==0){
if(tot2>tot3 ){
bolean2 = 3;
}else if(tot2<tot4 ) {
bolean3 = 3;
}else if(tot2==tot3){
for (int i = 0; i < vctGan2.size(); i++){
bolean2 = 0;
if(vctGan2[i] == eq3){
bolean3 = 3;
break;
}else if(vctGan2[i] != "" && vctGan3[i] ==eq2){
bolean2 = 3;
break;
}
}
}
if(tot2==tot3 and bolean2==0 and bolean3==0){
if(dif2>dif3 ){
bolean2 = 3;
}else if(dif2<dif3 ){
bolean3 = 3;
}
}
if( bolean2==0 and bolean3==0){
if(golTf2>golTf3){
bolean2 = 3;
}else if(golTf3>golTf2){
bolean3 = 3;
}else{
bolean2 = 3;
}
}
}
//Tercer lugar si el eq2 y eq3 ya tienen posicion
if(bolean2 != 0 and bolean3 !=0 and bolean1 ==0 and bolean4==0){
if(tot1>tot4 ){
bolean1 = 3;
}else if(tot1<tot4 ){
bolean4 = 3;
}else if(tot1==tot4){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq4){
bolean4 = 3;
break;
}else if(vctGan1[i] != "" && vctGan4[i] ==eq1){
bolean1 = 3;
break;
}
}
}
if(tot1==tot4 and bolean1==0 and bolean4==0){
if(dif1>dif4 ){
bolean1 = 3;
}else if(dif1<dif4 ){
bolean4 = 3;
}
}
if(bolean1==0 and bolean4==0){
if(golTf1>golTf4){
bolean1 = 3;
}else if(golTf4>golTf1){
bolean4 = 3;
}else{
bolean1 = 3;
}
}
}
//Tercer lugar si el eq2 y eq4 ya tienen posicion
if(bolean2 != 0 and bolean4 !=0 and bolean1 ==0 and bolean3==0){
if(tot1>tot3 ){
bolean1 = 3;
}else if(tot1<tot3) {
bolean3 = 3;
}else if(tot1==tot3){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq3){
bolean3 = 3;
break;
}else if(vctGan1[i] != "" && vctGan3[i] ==eq1){
bolean1 = 3;
break;
}
}
}
if(tot1==tot3 and bolean1==0 and bolean3==0){
if(dif1>dif3 ){
bolean1 = 3;
}else if(dif1<dif3 ){
bolean3 = 3;
}
}
if(bolean1==0 and bolean3==0){
if(golTf1>golTf3){
bolean1 = 3;
}else if(golTf3>golTf1){
bolean3 = 3;
}else{
bolean1 = 3;
}
}
}
//Tercer lugar si el eq3 y eq4 ya tienen posicion
if(bolean3 != 0 and bolean4 !=0 and bolean1 ==0 and bolean2==0){
if(tot1>tot2 ){
bolean1 = 3;
}else if(tot1<tot2 ){
bolean2 = 3;
}else if(tot1==tot2){
for (int i = 0; i < vctGan1.size(); i++){
bolean1 = 0;
if(vctGan1[i] == eq2){
bolean2 = 3;
break;
}else if(vctGan1[i] != "" && vctGan2[i] ==eq1 ){
bolean1 = 3;
break;
}
}
}
if(tot1==tot2 and bolean1==0 and bolean2==0){
if(dif1>dif2 ){
bolean1 = 3;
}else if(dif1<dif2 ){
bolean2 = 3;
}
}
if(bolean1==0 and bolean2==0){
if(golTf1>golTf2){
bolean1 = 3;
}else if(golTf2>golTf1){
bolean2 = 3;
}else{
bolean1 = 3;
}
}
}
if(bolean1 == 0){
bolean1 = 4;
}else if(bolean2 == 0){
bolean1 = 4;
}else if(bolean3 == 0){
bolean1 = 4;
}else{
bolean1 = 4;
}
cout<<"Pais Ganados Perdidos GF GC DIF Pts Empatados"<<endl;
resultados(bolean1,bolean2,bolean3,bolean4,emGanPer1,emGanPer2,emGanPer3,emGanPer4);
}