Advertisement
nasho97

Mod2Cuest3Preg2

Sep 10th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.09 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5.     unsigned short N;
  6.    
  7.     do
  8.     {
  9.         scanf ("%hu",&N);
  10.         fflush(stdin);
  11.     }while (N>10);
  12.    
  13.     if (N>2)
  14.     {
  15.        
  16.         unsigned short i,j;
  17.         unsigned short Igual;
  18.         unsigned short IgualMax=0;
  19.         unsigned short Porcentaje;
  20.         unsigned short IgualSospechosos [N];
  21.         char Sospechosos[N][51];
  22.         char AdnSospechosos [N][40];
  23.         char Adn [40];
  24.        
  25.        
  26.         for (i=0;i<N;i++)
  27.         {
  28.             scanf("%50[^\n]",Sospechosos [i]);
  29.             fflush(stdin);
  30.             scanf("%39[^\n]",AdnSospechosos [i]);
  31.             fflush(stdin);
  32.         }
  33.        
  34.         scanf("%39[^\n]",Adn);
  35.         fflush(stdin);
  36.        
  37.         for (i=0;i<N;i++)
  38.         {
  39.             Igual=0;
  40.             for (j=0;j<40;j+=2)
  41.             {
  42.                 if (AdnSospechosos[i][j]==Adn[j])
  43.                 {
  44.                     Igual++;
  45.                 }
  46.             }
  47.             IgualSospechosos [i]=Igual;
  48.             if (IgualMax<Igual)
  49.             {
  50.                 IgualMax=Igual;
  51.             }
  52.         }
  53.        
  54.         Porcentaje=(IgualMax*5);
  55.        
  56.         for (i=0;i<N;i++)
  57.         {
  58.             if (IgualMax==IgualSospechosos[i])
  59.             {
  60.                 printf ("El culpable es %s con una similitud de %hu%%\n",Sospechosos [i],Porcentaje);
  61.             }
  62.         }
  63.                
  64.     }
  65.     else
  66.     {
  67.         printf("No hay suficientes sospechosos");
  68.     }
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement