Advertisement
Jvsierra

aaaaa

May 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6.     int i, linhaCavalo, c = 0, contMov, aux;
  7.     char colunaCavalo;
  8.     char Peoes[8][10];
  9.    
  10.     scanf("%d", &linhaCavalo);
  11.    
  12.     while(linhaCavalo > 0)
  13.     {
  14.         scanf(" %c", &colunaCavalo);
  15.         c++;
  16.        
  17.         getchar();
  18.        
  19.         for(i = 0; i < 8; i++)
  20.         {
  21.             gets(Peoes[i]);
  22.             printf("%s\n", Peoes[i]);
  23.         }
  24.        
  25.         contMov = 0;
  26.        
  27.         if(linhaCavalo <= 6)
  28.         {
  29.             if(colunaCavalo >= 'b')
  30.             {
  31.                 aux = 0;
  32.                
  33.                 for(i = 0; i < 8 && aux == 0; i++)
  34.                     if(( (Peoes[i][0] - 48) > 1 && Peoes[i][1] + 1 ==) || (Peoes[i][0] - 48 > 1))
  35.                         aux = 1;
  36.                    
  37.                 if(aux == 0)
  38.                     contMov++;
  39.             }  
  40.         }  
  41.        
  42.         printf("Caso de teste #%d: %d movimento(s).\n", c, contMov);
  43.        
  44.         scanf("%d", &linhaCavalo);
  45.     }  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement