Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Leandro Soares, I100067 - TGPSI10-01
- #include <stdio.h>
- #define TRUE 1
- int validacoes(int a, int b);
- int main()
- {
- int Bgolos=0, Agolos=0, AAC=0;
- int jogo=1;
- int MGolos=0, mGolos=0;
- while(TRUE)
- {
- printf("\nResultado do jogo %d: ", jogo);
- fflush(stdin);
- scanf("%d-%d", &Bgolos, &Agolos);
- if( Bgolos == 100 && Agolos == 100)
- break;
- if( !validacoes(Bgolos, Agolos) )
- {
- printf("Resultado Invalido\n");
- continue;
- }
- if( jogo == 1 )
- {
- MGolos = Bgolos + Agolos;
- mGolos = MGolos;
- }
- else
- if( Bgolos + Agolos > MGolos )
- MGolos = Agolos + Bgolos;
- else
- if( Bgolos + Agolos < mGolos )
- mGolos = Bgolos + Agolos;
- if( Agolos > Bgolos )
- AAC+=3;
- else
- if( Agolos == Bgolos )
- AAC++;
- jogo++;
- }
- printf("\nMaior numero de Golos num Jogo: %d\n", MGolos);
- printf("Menor numero de Golos num Jogo: %d\n", mGolos);
- printf("Pontos COnquistados pela AAC: %d\n\n", AAC);
- return 0;
- }
- int validacoes(int a, int b)
- {
- if(a >= 0 && a <= 100 && b >= 0 && b <= 100)
- return 1;
- else
- return 0;
- if( ( a == 100 && b != 100 ) || ( a != 100 && b == 100 ) )
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement