Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> #include <string.h> int main() { int tst; char f[10], s[10]; scanf("%d", &tst); while(tst--) { scanf("%s", f); scanf("%s", s); if(f[1]=='e' && s[1]=='e') printf("Sem ganhador\n"); else if(f[1]=='t' && s[1]=='t') printf("Aniquilacao mutua\n"); else if(f[1]=='a' && s[1]=='a') printf("Ambos venceram\n"); else if(f[1]=='t' || (f[1]=='e' && s[1]=='a')) printf("Jogador 1 venceu\n"); else printf("Jogador 2 venceu\n"); } return 0; }
valeu ai chorao
ReplyDeleteThanks for teaching me two things: even simpler usage of while structure and avoiding same char comparisons.
ReplyDelete