GatoBooster

Cuestionario 2 preg 4

Sep 12th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #define MAX 601
  5.  
  6. int main(){
  7.     char vector[MAX]={};
  8.     char alumno[MAX]={};
  9.     char matriz[3][101]={};
  10.     int num,i,j,k,h,cont,contV,largo1,largo2,largo3;
  11.  
  12.     scanf("%d",&num);
  13.  
  14.     for(i=0; i < 3;i++){
  15.         scanf("%101[^\n]",vector);
  16.         cont=0;
  17.         for(j=0; j<MAX; j++){
  18.             if(vector[j] >= 'a' && vector [j] <= 'z'){
  19.                 matriz[i][cont] = vector[j];
  20.                 cont++;
  21.             }
  22.             if(vector[j] >= 'A' && vector [j] <= 'Z'){
  23.                 alumno[cont] = toupper(vector[j]);
  24.                 cont++;
  25.             }
  26.         }
  27.     }
  28.    
  29.     for(i=0; i<num; i++){
  30.        
  31.         scanf("%101[^\n]",vector);
  32.         cont=0;
  33.        
  34.         for(j=0; j<MAX; j++){
  35.             if(vector[j] >= 'a' && vector [j] <= 'z'){         //Si el caracter es minuscula se guarda
  36.                 alumno[cont] = vector[j];
  37.                 cont++;
  38.             }
  39.             if(vector[j] >= 'A' && vector [j] <= 'Z'){         //Si el caracter es mayuscula se aplica toupper()
  40.                 alumno[cont] = toupper(vector[j]);             //y se guarda en minuscula
  41.                 cont++;
  42.             }
  43.         }
  44.         cont = 0;
  45.         for(k = 0; k < 3; k++){
  46.             largo1 = strlen(matriz[k]);
  47.             largo2 = strlen(vector);
  48.             largo3 = 0;
  49.             for(j = 0; j < largo2-largo1; j++){
  50.                 for(h = 0; h > largo2; h++){
  51.                     contV++;
  52.                 }
  53.                 if(contV == largo1){
  54.                     cont++;
  55.                     largo3 += contV;
  56.                 }else{
  57.                     contV = 0;
  58.                 }
  59.             }
  60.         }
  61.        
  62.         for(j = 0;j<3;j++){
  63.             for(k=0;k<largo1;k++){
  64.                 printf("%s",matriz[j][k]);
  65.             }
  66.         }
  67.         /*if(largo3 == largo2){
  68.             printf("ACC\n");
  69.         }else{
  70.             printf("WA\n");
  71.         }*/    
  72.    }
  73.    
  74.     return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment