#include #include #include #include using namespace std; char* kamien[11]={"Kamen", "Rock", "Pierre", "Stein", "Ko", "Koe", "Sasso", "Roccia", "Guu", "Kamien", "Piedra"}; char* nozyczki[11]={"Nuzky", "Scissors", "Ciseaux", "Schere", "Ollo", "Olloo", "Forbice", "Choki", "Nozyce", "Tijera", "Tijera"}; char* papier[11]={"Papir", "Paper", "Feuille", "Papier", "Papir", "Carta", "Rete", "Paa", "Papier", "Papel", "Papel"}; int which(char* co) { for(int i=0; i<11; i++) { if(strcmp(co, kamien[i])==0) return 0; // kamien if(strcmp(co, nozyczki[i])==0) return 1; // nozyczki if(strcmp(co, papier[i])==0) return 2; // papier } } int wygra(char* shape1, char* shape2) // -1 -wygra 1, 1 wygra 2 { int ktory1, ktory2; ktory1=which(shape1); ktory2=which(shape2); if(ktory1==ktory2) return 0; else { if(ktory1==0) { if(ktory2==1) return -1; else return 1; } else { if(ktory1==1) { if(ktory2==0) return 1; else return -1; } else // ktory1==2 { if(ktory2==0) return -1; else return 1; } } } } int main() { char name1[50], name2[50], temp[50], temp2[50]; char shape1[50], shape2[50]; int name1P=0; int name2P=0; int games=0; while(true) //to { scanf("%s%s",temp,name1); scanf("%s%s",temp,name2); scanf("%s",shape1); while((shape1[0]!='-')&&(shape1[0]!='.')){ scanf("%s",shape2); int rez=wygra(shape1, shape2); if(rez==-1) name1P++; else { if(rez==1) name2P++; } scanf("%s", shape1); } printf("Game #%d:\n", ++games); printf("%s: %d point", name1, name1P); if(name1P!=1) printf("s"); printf("\n"); printf("%s: %d point", name2, name2P); if(name2P!=1) printf("s"); printf("\n"); if(name1P==name2P) printf("TIED GAME\n"); else { printf("WINNER: "); if(name1P>name2P) printf("%s", name1); else printf("%s", name2); printf("\n"); } if(shape1[0]!='.'){ printf("\n"); } else break; name1P=name2P=0; } return 0; }