Advertisement
FoxTuGa

Benfica.AAC - Teste <Old>

May 8th, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.17 KB | None | 0 0
  1. // Leandro Soares, I100067 - TGPSI10-01
  2. #include <stdio.h>
  3.  
  4. #define TRUE 1
  5.  
  6. int validacoes(int a, int b);
  7.  
  8. int main()
  9. {
  10.     int Bgolos=0, Agolos=0, AAC=0;
  11.     int jogo=1;
  12.     int MGolos=0, mGolos=0;
  13.  
  14.     while(TRUE)
  15.     {
  16.         printf("\nResultado do jogo %d: ", jogo);
  17.         fflush(stdin);
  18.         scanf("%d-%d", &Bgolos, &Agolos);
  19.  
  20.         if( Bgolos == 100 && Agolos == 100)
  21.             break;
  22.  
  23.         if( !validacoes(Bgolos, Agolos) )
  24.         {
  25.             printf("Resultado Invalido\n");
  26.             continue;
  27.         }
  28.  
  29.         if( jogo == 1 )
  30.         {
  31.             MGolos = Bgolos + Agolos;
  32.             mGolos = MGolos;
  33.         }
  34.         else
  35.             if( Bgolos + Agolos > MGolos )
  36.                 MGolos = Agolos + Bgolos;
  37.             else
  38.                 if( Bgolos + Agolos < mGolos )
  39.                     mGolos = Bgolos + Agolos;
  40.  
  41.         if( Agolos > Bgolos )
  42.             AAC+=3;
  43.         else
  44.             if( Agolos == Bgolos )
  45.                 AAC++;
  46.  
  47.  
  48.             jogo++;
  49.     }
  50.  
  51.     printf("\nMaior numero de Golos num Jogo: %d\n", MGolos);
  52.     printf("Menor numero de Golos num Jogo: %d\n", mGolos);
  53.     printf("Pontos COnquistados pela AAC: %d\n\n", AAC);
  54.  
  55.     return 0;
  56. }
  57.  
  58. int validacoes(int a, int b)
  59. {
  60.     if(a >= 0 && a <= 100 && b >= 0 && b <= 100)
  61.         return 1;
  62.     else
  63.         return 0;
  64.  
  65.     if( ( a == 100 && b != 100 ) || ( a != 100 && b == 100 ) )
  66.         return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement