Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct teams{
- int victories, defeats, draws, goals_made, goals_suffered, games, points;
- char name[30];
- }TEAMS;
- int ret, ret2, cont, cont2;
- char caractere, caractere2;
- char line[30], line2[30];
- int i, j, k, l = 0, h = 0, n, t = 0, x = 30; //t = number of teams n = number of championships
- char championship[100];
- unsigned int g; //g = number of games already played in the championship
- char useless;
- int value1, value2;
- TEAMS zoera[30];
- scanf("%d", &n);
- fflush(stdin);
- for(i = 0; i < n; i++){
- scanf("%[^n]", championship);
- scanf("%d", &t);
- for(j = 0; j < t; j++){
- scanf("%s", zoera[j].nome);
- }
- scanf("%u", &g);
- for(k = 0; k < g; k++){
- //scanf("%s", azedo2[k]);
- do{
- caractere = getchar();
- line[l] = caractere;
- l++;
- }while(caractere != '#');
- for(cont = 0; cont < t; cont++){
- ret = strcmp(line, zoera[cont].nome);
- if(ret == 0){
- scanf("%c", &useless);
- scanf("%d", &value1);
- scanf("%c", &useless);
- scanf("%d", &value2);
- do{
- caractere2 = getchar();
- line2[h] = caractere2;
- h++;
- }while(caractere2 != 'n');
- for(cont2 = 0; cont2 < t; cont2++){
- ret2 = strcmp(line2, zoera[cont2].nome);
- if(ret2 == 0){
- zoera[cont].jogos += 1;
- zoera[cont2].jogos += 1;
- zoera[cont].gols_feitos += value1;
- zoera[cont2].gols_feitos += value2;
- zoera[cont].gols_sofridos += value2;
- zoera[cont2].gols_sofridos += value1;
- if(value1 > value2){
- zoera[cont].pontos += 3;
- zoera[cont].vitorias += 1;
- zoera[cont2].derrotas += 1;
- }
- if(value1 == value2){
- zoera[cont].pontos += 1;
- zoera[cont2].pontos += 1;
- zoera[cont].empates += 1;
- zoera[cont2].empates += 1;
- }
- else{
- zoera[cont2].pontos += 3;
- zoera[cont2].vitorias += 1;
- zoera[cont].derrotas += 1;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement